Returns information about field widgets from AnnotatedClassDiscovery.
string $widget_type: (optional) A widget type name. If omitted, all widget types will be returned.
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.
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();
}
}