Define Field API widget types.
Field API widgets specify how fields are displayed in edit forms. Fields of a given field type may be edited using more than one widget. In this case, the Field UI module allows the site builder to choose which widget to use.
Widgets are Plugins managed by the Drupal\field\Plugin\Type\Widget\WidgetPluginManager class. A widget is implemented by providing a class that implements Drupal\field\Plugin\Type\Widget\WidgetInterface (in most cases, by subclassing Drupal\field\Plugin\Type\Widget\WidgetBase), and provides the proper annotation block.
Widgets are Form API elements with additional processing capabilities. The methods of the WidgetInterface object are typically called by the Field Attach API during the creation of the field form structure with field_attach_form().
Name | Location | Description |
---|---|---|
hook_field_widget_form_alter |
drupal/ |
Alter forms for field widgets provided by other modules. |
hook_field_widget_info_alter |
drupal/ |
Perform alterations on Field API widget types. |
hook_field_widget_WIDGET_TYPE_form_alter |
drupal/ |
Alter widget forms for a specific widget provided by another module. |