You are here

public function OptionsWidgetBase::__construct in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsWidgetBase.php \Drupal\Core\Field\Plugin\Field\FieldWidget\OptionsWidgetBase::__construct()
  2. 9 core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsWidgetBase.php \Drupal\Core\Field\Plugin\Field\FieldWidget\OptionsWidgetBase::__construct()

Constructs a WidgetBase object.

Parameters

string $plugin_id: The plugin_id for the widget.

mixed $plugin_definition: The plugin implementation definition.

\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The definition of the field to which the widget is associated.

array $settings: The widget settings.

array $third_party_settings: Any third party settings.

Overrides WidgetBase::__construct

1 call to OptionsWidgetBase::__construct()
ModerationStateWidget::__construct in core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php
Constructs a new ModerationStateWidget object.
1 method overrides OptionsWidgetBase::__construct()
ModerationStateWidget::__construct in core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php
Constructs a new ModerationStateWidget object.

File

core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsWidgetBase.php, line 36

Class

OptionsWidgetBase
Base class for the 'options_*' widgets.

Namespace

Drupal\Core\Field\Plugin\Field\FieldWidget

Code

public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings) {
  parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $third_party_settings);
  $property_names = $this->fieldDefinition
    ->getFieldStorageDefinition()
    ->getPropertyNames();
  $this->column = $property_names[0];
}