Constructs a WidgetBase object.
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
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;
}