public function WidgetBase::__construct

Constructs a WidgetBase object.

Parameters

array $plugin_id: The plugin_id for the widget.

Drupal\Component\Plugin\Discovery\DiscoveryInterface $discovery: The Discovery class that holds access to the widget implementation definition.

Drupal\field\FieldInstance $instance: The field instance to which the widget is associated.

array $settings: The widget settings.

int $weight: The widget weight.

Overrides PluginBase::__construct

File

drupal/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetBase.php, line 63
Definition of Drupal\field\Plugin\Type\Widget\WidgetBase.

Class

WidgetBase
Base class for 'Field widget' plugin implementations.

Namespace

Drupal\field\Plugin\Type\Widget

Code

public function __construct($plugin_id, DiscoveryInterface $discovery, FieldInstance $instance, array $settings, $weight) {
  parent::__construct(array(), $plugin_id, $discovery);
  $this->instance = $instance;
  $this->field = field_info_field($instance['field_name']);
  $this->settings = $settings;
  $this->weight = $weight;
}