function hook_element_info_alter

Same name in other branches
  1. 9 core/lib/Drupal/Core/Render/theme.api.php \hook_element_info_alter()
  2. 8.9.x core/lib/Drupal/Core/Render/theme.api.php \hook_element_info_alter()
  3. 10 core/lib/Drupal/Core/Render/theme.api.php \hook_element_info_alter()
  4. 11.x core/lib/Drupal/Core/Render/theme.api.php \hook_element_info_alter()

Alter the element type information returned from modules.

A module may implement this hook in order to alter the element type defaults defined by a module.

Parameters

$type: All element type defaults as collected by hook_element_info().

See also

hook_element_info()

Related topics

1 invocation of hook_element_info_alter()
element_info in includes/common.inc
Retrieves the default properties for the defined element type.

File

modules/system/system.api.php, line 702

Code

function hook_element_info_alter(&$type) {
    // Decrease the default size of textfields.
    if (isset($type['textfield']['#size'])) {
        $type['textfield']['#size'] = 40;
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.