function FieldTestFieldHooks::fieldWidgetInfoAlter
Implements hook_field_widget_info_alter().
File
-
core/
modules/ field/ tests/ modules/ field_test/ src/ Hook/ FieldTestFieldHooks.php, line 23
Class
- FieldTestFieldHooks
- Hook implementations for field_test.
Namespace
Drupal\field_test\HookCode
public function fieldWidgetInfoAlter(&$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.