class ElementInfoTestHooks

Hook implementations for element_info_test.

Hierarchy

Expanded class hierarchy of ElementInfoTestHooks

File

core/modules/system/tests/modules/element_info_test/src/Hook/ElementInfoTestHooks.php, line 14

Namespace

Drupal\element_info_test\Hook
View source
class ElementInfoTestHooks {
  
  /**
   * Implements hook_element_info_alter().
   */
  public function elementInfoAlter(array &$info) : void {
    $info['number'] += [
      '#pre_render' => [],
    ];
    /* @see \Drupal\KernelTests\Core\Render\Element\WeightTest::testProcessWeightSelectMax() */
    $info['number']['#pre_render'][] = [
      ElementInfoTestNumberBuilder::class,
      'preRender',
    ];
  }
  
  /**
   * Implements hook_element_plugin_alter().
   */
  public function elementPluginAlter(array &$definitions) : void {
    if (\Drupal::state()->get('hook_element_plugin_alter:remove_weight', FALSE)) {
      unset($definitions['weight']);
    }
    $definitions['details']['class'] = Details::class;
    $definitions['details']['provider'] = 'element_info_test';
  }

}

Members

Title Sort descending Modifiers Object type Summary
ElementInfoTestHooks::elementInfoAlter public function Implements hook_element_info_alter().
ElementInfoTestHooks::elementPluginAlter public function Implements hook_element_plugin_alter().

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