element_info_test.module

Same filename in other branches
  1. 9 core/modules/system/tests/modules/element_info_test/element_info_test.module
  2. 10 core/modules/system/tests/modules/element_info_test/element_info_test.module
  3. 11.x core/modules/system/tests/modules/element_info_test/element_info_test.module

Element info test.

File

core/modules/system/tests/modules/element_info_test/element_info_test.module

View source
<?php


/**
 * @file
 * Element info test.
 */

/**
 * Implements hook_element_info_alter().
 */
function element_info_test_element_info_alter(array &$info) {
    $info['number'] += [
        '#pre_render' => [],
    ];
    
    /* @see \Drupal\KernelTests\Core\Render\Element\WeightTest::testProcessWeightSelectMax() */
    $info['number']['#pre_render'][] = 'element_info_test_element_pre_render';
}

/**
 * Implements hook_element_plugin_alter().
 */
function element_info_test_element_plugin_alter(array &$definitions) {
    if (\Drupal::state()->get('hook_element_plugin_alter:remove_weight', FALSE)) {
        unset($definitions['weight']);
    }
}

/**
 * {@inheritdoc}
 *
 * @see \Drupal\KernelTests\Core\Render\Element\WeightTest::testProcessWeightSelectMax()
 */
function element_info_test_element_pre_render(array $element) {
    return $element;
}

Functions

Title Deprecated Summary
element_info_test_element_info_alter Implements hook_element_info_alter().
element_info_test_element_plugin_alter Implements hook_element_plugin_alter().
element_info_test_element_pre_render

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