function hook_element_plugin_alter

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

1 function implements hook_element_plugin_alter()

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

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 870

Code

function hook_element_plugin_alter(array &$definitions) {
    // Use a custom class for the LayoutBuilder element.
    $definitions['layout_builder']['class'] = '\\Drupal\\my_module\\Element\\MyLayoutBuilderElement';
}

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