Same name and namespace in other branches
  1. 7.x modules/system/system.api.php \hook_element_info_alter()
  2. 8.9.x core/lib/Drupal/Core/Render/theme.api.php \hook_element_info_alter()
  3. 9 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

9 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

File

core/lib/Drupal/Core/Render/theme.api.php, line 850
Hooks and documentation related to the theme and render system.

Code

function hook_element_info_alter(array &$info) {

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