Dru Documentation

Go to front page

developer/hooks/core.php, string 450 Versions 5 - 6 hook_elements () "Translation" the Pre-image Allows units to define own types of units Forms API and to define their default values. The expositions of units returned by it хуком, will be added to the data from хука hook_form (), and become default values for new units. Therefore in these expositions, except the keys explicitly described more low, can contain any other keys Forms API. With each new unit function темирования with the same name, responsible for conversion of this unit in HTML implicitly communicates. For the unit defined in the unit with a name ' elementtype ', standard function темирования should be realised in the same unit by function theme_elementtype (). Function темирования, as well as any another, it is necessary to register this with the help хука hook_theme (). More in detail about creation of user's types of units and about operation specified more low коллбеков it is possible to read on page http://drupal.org/node/169815. Returned value The associative array describing all defined types of units. Keys of the array are titles of new types of the units, values corresponding to them (exposition of each new unit) in turn are associative arrays with such keys: * ' #input ': whether contains a unit value, or not (it is not dependent on, whether is mapped the unit on the form or is hidden). * ' #value_callback ': a name коллбека which is called for a modification of value of the field. If this field is not specified, by default the name of it коллбека considers form_type_имяэлемента_value (). Коллбек receives parametres $element and $edit, and should return new value ' #value ' for a unit. If коллбек it is not defined, in quality ' #value ' the reference value introduced by the user is taken. * ' #process ': the list коллбеков with parametres $element, $edit, &$form_state, $complete_form. * ' #after_build ': the list коллбеков with parametres $element and &$form_state. * ' #validate ': the list коллбеков with parametres $form and &$form_state. * ' #element_validate ': the list коллбеков with parametres $element and &$form_state. * ' #pre_render ': the list коллбеков with parametre $element. * ' #post_render ': the list коллбеков with parametres $content and $element. * ' #submit ': the list коллбеков with parametres $form and &$form_state. Allows modules to declare their own Forms API element types and specify their default values. This hook allows modules to declare their own form element types and to specify their default values. The values returned by this hook will be merged with the elements returned by hook_form () implementations and so can return defaults for any Form APIs keys in addition to those explicitly mentioned below. Each of the form element types defined by this hook is assumed to have a matching theme function, e.g. theme_elementtype (), which should be registered with hook_theme () as normal. Form more information about custom element types see the explanation at http://drupal.org/node/169815. Return value An associative array describing the element types being defined. The array contains a sub-array for each element type, with the machine-readable type name as the key. Each sub-array has a number of possible attributes: * "#input": boolean indicating whether or not this element carries a value (even if it's hidden). * "#process": array of callback functions taking $element and $form_state. * "#after_build": array of callback functions taking $element and $form_state. * "#validate": array of callback functions taking $form and $form_state. * "#element_validate": array of callback functions taking $element and $form_state. * "#pre_render": array of callback functions taking $element and $form_state. * "#post_render": array of callback functions taking $element and $form_state. * "#submit": array of callback functions taking $form and $form_state. The linked subjects Хуки Allows units to co-operate with kernel Drupal. ? 1 function calls hook_elements () ? 1 function calls hook_elements () _element_info in includes/form.inc Retrieve the default properties for the defined element type.