You are here

public function ImageWidget::__construct in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php \Drupal\image\Plugin\Field\FieldWidget\ImageWidget::__construct()

Constructs an ImageWidget 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.

\Drupal\Core\Render\ElementInfoManagerInterface $element_info: The element info manager service.

\Drupal\Core\Image\ImageFactory $image_factory: The image factory service.

Overrides FileWidget::__construct

File

core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php, line 52

Class

ImageWidget
Plugin implementation of the 'image_image' widget.

Namespace

Drupal\image\Plugin\Field\FieldWidget

Code

public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings, ElementInfoManagerInterface $element_info, ImageFactory $image_factory = NULL) {
  parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $third_party_settings, $element_info);
  $this->imageFactory = $image_factory ?: \Drupal::service('image.factory');
}