function field_test_field_widget_info_alter

Same name in other branches
  1. 9 core/modules/field/tests/modules/field_test/field_test.field.inc \field_test_field_widget_info_alter()
  2. 8.9.x core/modules/field/tests/modules/field_test/field_test.field.inc \field_test_field_widget_info_alter()
  3. 11.x core/modules/field/tests/modules/field_test/field_test.field.inc \field_test_field_widget_info_alter()

Implements hook_field_widget_info_alter().

File

core/modules/field/tests/modules/field_test/field_test.field.inc, line 19

Code

function field_test_field_widget_info_alter(&$info) {
    $info['test_field_widget_multiple']['field_types'][] = 'test_field';
    $info['test_field_widget_multiple']['field_types'][] = 'test_field_with_preconfigured_options';
    // Add extra widget when needed for tests.
    // @see \Drupal\field\Tests\FormTest::widgetAlterTest().
    if ($alter_info = \Drupal::state()->get("field_test.widget_alter_test")) {
        if ($alter_info['widget'] === 'test_field_widget_multiple_single_value') {
            $info['test_field_widget_multiple_single_value']['field_types'][] = 'test_field';
        }
    }
}

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