function field_info_widget_types

Returns information about field widgets from AnnotatedClassDiscovery.

Parameters

string $widget_type: (optional) A widget type name. If omitted, all widget types will be returned.

Return value

array Either a single widget type description, as provided by class annotations, or an array of all existing widget types, keyed by widget type name.

Related topics

5 calls to field_info_widget_types()
FieldInfoTest::testSettingsInfo in drupal/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php
Test that the field_info settings convenience functions work.
FieldInfoTest::testWidgetDefinition in drupal/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php
Test that the widget definition functions work.
FieldOverview::buildForm in drupal/core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php
Implements \Drupal\Core\Form\FormInterface::buildForm().
field_behaviors_widget in drupal/core/modules/field/field.info.inc
Determines the behavior of a widget with respect to an operation.
field_info_widget_settings in drupal/core/modules/field/field.info.inc
Returns a field widget's default settings.

File

drupal/core/modules/field/field.info.inc, line 214
Field Info API, providing information about available fields and field types.

Code

function field_info_widget_types($widget_type = NULL) {
  if ($widget_type) {
    return drupal_container()
      ->get('plugin.manager.field.widget')
      ->getDefinition($widget_type);
  }
  else {
    return drupal_container()
      ->get('plugin.manager.field.widget')
      ->getDefinitions();
  }
}