function WidgetBase::__construct

Same name in other branches
  1. 9 core/lib/Drupal/Core/Field/WidgetBase.php \Drupal\Core\Field\WidgetBase::__construct()
  2. 8.9.x core/lib/Drupal/Core/Field/WidgetBase.php \Drupal\Core\Field\WidgetBase::__construct()
  3. 10 core/lib/Drupal/Core/Field/WidgetBase.php \Drupal\Core\Field\WidgetBase::__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.

5 calls to WidgetBase::__construct()
DateRangeDefaultWidget::__construct in core/modules/datetime_range/src/Plugin/Field/FieldWidget/DateRangeDefaultWidget.php
DateTimeDefaultWidget::__construct in core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDefaultWidget.php
FileWidget::__construct in core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php
MediaLibraryWidget::__construct in core/modules/media_library/src/Plugin/Field/FieldWidget/MediaLibraryWidget.php
Constructs a MediaLibraryWidget widget.
OptionsWidgetBase::__construct in core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsWidgetBase.php
5 methods override WidgetBase::__construct()
DateRangeDefaultWidget::__construct in core/modules/datetime_range/src/Plugin/Field/FieldWidget/DateRangeDefaultWidget.php
DateTimeDefaultWidget::__construct in core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDefaultWidget.php
FileWidget::__construct in core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php
MediaLibraryWidget::__construct in core/modules/media_library/src/Plugin/Field/FieldWidget/MediaLibraryWidget.php
Constructs a MediaLibraryWidget widget.
OptionsWidgetBase::__construct in core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsWidgetBase.php

File

core/lib/Drupal/Core/Field/WidgetBase.php, line 53

Class

WidgetBase
Base class for 'Field widget' plugin implementations.

Namespace

Drupal\Core\Field

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.