You are here

public function SvgImageWidget::__construct in Svg Image 1.x

Same name and namespace in other branches
  1. 8 src/Plugin/Field/FieldWidget/SvgImageWidget.php \Drupal\svg_image\Plugin\Field\FieldWidget\SvgImageWidget::__construct()
  2. 2.x src/Plugin/Field/FieldWidget/SvgImageWidget.php \Drupal\svg_image\Plugin\Field\FieldWidget\SvgImageWidget::__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 FileWidget::__construct

File

src/Plugin/Field/FieldWidget/SvgImageWidget.php, line 67

Class

SvgImageWidget
Override plugin of the 'image_image' widget.

Namespace

Drupal\svg_image\Plugin\Field\FieldWidget

Code

public function __construct($pluginId, $pluginDefinition, FieldDefinitionInterface $fieldDefinition, array $settings, array $thirdPartySettings, ContainerInterface $container) {
  parent::__construct($pluginId, $pluginDefinition, $fieldDefinition, $settings, $thirdPartySettings, $container
    ->get('element_info'));
  $this->container = $container;
  $this->entityRepository = $container
    ->get('entity.repository');
  $this->renderer = $container
    ->get('renderer');
  $this->entityTypeManager = $container
    ->get('entity_type.manager');
  $this->imageStyleStorage = $this->entityTypeManager
    ->getStorage('image_style');
}