1 system.api.php | hook_element_info() |
Allows modules to declare their own Form API element types and 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.
For 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, $form_state, and $complete_form.
- "#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.
- "#title_display": optional string indicating if and how #title should be displayed, see theme_form_element() and theme_form_element_label().
- "#description_display": Description display setting. It can have these
values:
- before: The description is output before the element.
- after: The description is output after the element. This is the default value.
- invisible: The description is output after the element, hidden visually but available to screen readers.
See also
Related topics
File
- core/
modules/ system/ system.api.php, line 248 - Hooks provided by Backdrop core and the System module.
Code
function hook_element_info() {
$types['filter_format'] = array(
'#input' => TRUE,
);
return $types;
}