function hook_element_plugin_alter
Same name and namespace in other branches
- 8.9.x core/lib/Drupal/Core/Render/theme.api.php \hook_element_plugin_alter()
- 10 core/lib/Drupal/Core/Render/theme.api.php \hook_element_plugin_alter()
- 11.x core/lib/Drupal/Core/Render/theme.api.php \hook_element_plugin_alter()
Alter Element plugin definitions.
Whenever possible, hook_element_info_alter() should be used to alter the default properties of an element type. Use this hook only when the plugin definition itself needs to be altered.
Parameters
array $definitions: An array of Element plugin definitions.
See also
\Drupal\Core\Render\ElementInfoManager
\Drupal\Core\Render\Element\ElementInterface
Related topics
2 functions implement hook_element_plugin_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.
- ElementInfoTestHooks::elementPluginAlter in core/
modules/ system/ tests/ modules/ element_info_test/ src/ Hook/ ElementInfoTestHooks.php - Implements hook_element_plugin_alter().
- element_info_test_element_plugin_alter in core/
modules/ system/ tests/ modules/ element_info_test/ element_info_test.module - Implements hook_element_plugin_alter().
1 invocation of hook_element_plugin_alter()
- ElementInfoManager::__construct in core/
lib/ Drupal/ Core/ Render/ ElementInfoManager.php - Constructs an ElementInfoManager object.
File
-
core/
lib/ Drupal/ Core/ Render/ theme.api.php, line 833
Code
function hook_element_plugin_alter(array &$definitions) {
// Use a custom class for the LayoutBuilder element.
$definitions['layout_builder']['class'] = '\\Drupal\\mymodule\\Element\\MyLayoutBuilderElement';
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.