function hook_element_info_alter

Same name in other branches
  1. 7.x modules/system/system.api.php \hook_element_info_alter()
  2. 9 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

array $info: An associative array with structure identical to that of the return value of \Drupal\Core\Render\ElementInfoManagerInterface::getInfo().

See also

\Drupal\Core\Render\ElementInfoManager

\Drupal\Core\Render\Element\ElementInterface

Related topics

11 functions implement hook_element_info_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

claro_element_info_alter in core/themes/claro/claro.theme
Implements hook_element_info_alter().
content_translation_element_info_alter in core/modules/content_translation/content_translation.module
Implements hook_element_info_alter().
editor_element_info_alter in core/modules/editor/editor.module
Implements hook_element_info_alter().
element_info_test_element_info_alter in core/modules/system/tests/modules/element_info_test/element_info_test.module
Implements hook_element_info_alter().
inline_form_errors_element_info_alter in core/modules/inline_form_errors/inline_form_errors.module
Implements hook_element_info_alter().

... See full list

1 invocation of hook_element_info_alter()
ElementInfoManager::buildInfo in core/lib/Drupal/Core/Render/ElementInfoManager.php
Builds up all element information.

File

core/lib/Drupal/Core/Render/theme.api.php, line 809

Code

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

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