class FieldWidget
Same name in this branch
- 10 core/lib/Drupal/Core/Field/Annotation/FieldWidget.php \Drupal\Core\Field\Annotation\FieldWidget
Same name in other branches
- 9 core/lib/Drupal/Core/Field/Annotation/FieldWidget.php \Drupal\Core\Field\Annotation\FieldWidget
- 8.9.x core/lib/Drupal/Core/Field/Annotation/FieldWidget.php \Drupal\Core\Field\Annotation\FieldWidget
- 11.x core/lib/Drupal/Core/Field/Attribute/FieldWidget.php \Drupal\Core\Field\Attribute\FieldWidget
- 11.x core/lib/Drupal/Core/Field/Annotation/FieldWidget.php \Drupal\Core\Field\Annotation\FieldWidget
Defines a FieldWidget attribute for plugin discovery.
Plugin Namespace: Plugin\Field\FieldWidget
Widgets handle how fields are displayed in edit forms.
Additional attribute keys for widgets can be defined in hook_field_widget_info_alter().
Hierarchy
- class \Drupal\Component\Plugin\Attribute\AttributeBase implements \Drupal\Component\Plugin\Attribute\AttributeInterface
- class \Drupal\Component\Plugin\Attribute\Plugin extends \Drupal\Component\Plugin\Attribute\AttributeBase
- class \Drupal\Core\Field\Attribute\FieldWidget extends \Drupal\Component\Plugin\Attribute\Plugin
- class \Drupal\Component\Plugin\Attribute\Plugin extends \Drupal\Component\Plugin\Attribute\AttributeBase
Expanded class hierarchy of FieldWidget
See also
\Drupal\Core\Field\WidgetPluginManager
\Drupal\Core\Field\WidgetInterface
Related topics
38 files declare their use of FieldWidget
- BooleanCheckboxWidget.php in core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldWidget/ BooleanCheckboxWidget.php - CommentWidget.php in core/
modules/ comment/ src/ Plugin/ Field/ FieldWidget/ CommentWidget.php - DateRangeDatelistWidget.php in core/
modules/ datetime_range/ src/ Plugin/ Field/ FieldWidget/ DateRangeDatelistWidget.php - DateRangeDefaultWidget.php in core/
modules/ datetime_range/ src/ Plugin/ Field/ FieldWidget/ DateRangeDefaultWidget.php - DateTimeDatelistWidget.php in core/
modules/ datetime/ src/ Plugin/ Field/ FieldWidget/ DateTimeDatelistWidget.php
File
-
core/
lib/ Drupal/ Core/ Field/ Attribute/ FieldWidget.php, line 23
Namespace
Drupal\Core\Field\AttributeView source
class FieldWidget extends Plugin {
/**
* Constructs a FieldWidget attribute.
*
* @param string $id
* The plugin ID.
* @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $label
* (optional) The human-readable name of the widget type.
* @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $description
* (optional) A short description of the widget type.
* @param string[] $field_types
* (optional) An array of field types the widget supports.
* @param bool $multiple_values
* (optional) Does the field widget handles multiple values at once.
* @param int|null $weight
* (optional) An integer to determine weight of this widget relative to
* other widgets. Other widgets are in the Field UI when selecting a widget
* for a given field.
* @param class-string|null $deriver
* (optional) The deriver class.
*/
public function __construct(string $id, ?TranslatableMarkup $label = NULL, ?TranslatableMarkup $description = NULL, array $field_types = [], bool $multiple_values = FALSE, ?int $weight = NULL, ?string $deriver = NULL) {
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
AttributeBase::$class | protected | property | The class used for this attribute class. | ||
AttributeBase::$provider | protected | property | The provider of the attribute class. | ||
AttributeBase::get | public | function | Gets the value of an attribute. | Overrides AttributeInterface::get | 6 |
AttributeBase::getClass | public | function | Gets the class of the attribute class. | Overrides AttributeInterface::getClass | 1 |
AttributeBase::getId | public | function | Gets the unique ID for this attribute class. | Overrides AttributeInterface::getId | |
AttributeBase::getProvider | public | function | Gets the name of the provider of the attribute class. | Overrides AttributeInterface::getProvider | |
AttributeBase::setClass | public | function | Sets the class of the attributed class. | Overrides AttributeInterface::setClass | 1 |
AttributeBase::setProvider | public | function | Sets the name of the provider of the attribute class. | Overrides AttributeInterface::setProvider | |
FieldWidget::__construct | public | function | Constructs a FieldWidget attribute. | Overrides Plugin::__construct |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.