function hook_element_info_alter
Same name and namespace in other branches
- 7.x modules/system/system.api.php \hook_element_info_alter()
- 8.9.x core/lib/Drupal/Core/Render/theme.api.php \hook_element_info_alter()
- 10 core/lib/Drupal/Core/Render/theme.api.php \hook_element_info_alter()
- 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
21 functions implement hook_element_info_alter()
Note: the procedural functions in this list are found by pattern matching, so the list may include some functions that are not actually implementations of this hook.
- BigPipeMessagesHooks::elementInfoAlter in core/
modules/ big_pipe/ tests/ modules/ big_pipe_messages_test/ src/ Hook/ BigPipeMessagesHooks.php - Implements hook_element_info_alter().
- claro_element_info_alter in core/
themes/ claro/ claro.theme - Implements hook_element_info_alter().
- ContentTranslationHooks::elementInfoAlter in core/
modules/ content_translation/ src/ Hook/ ContentTranslationHooks.php - Implements hook_element_info_alter().
- content_translation_element_info_alter in core/
modules/ content_translation/ content_translation.module - Implements hook_element_info_alter().
- EditorHooks::elementInfoAlter in core/
modules/ editor/ src/ Hook/ EditorHooks.php - Implements hook_element_info_alter().
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 813
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.