function ResponsiveImageFormatter::__construct
Same name and namespace in other branches
- 10 core/modules/responsive_image/src/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php \Drupal\responsive_image\Plugin\Field\FieldFormatter\ResponsiveImageFormatter::__construct()
- 11.x core/modules/responsive_image/src/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php \Drupal\responsive_image\Plugin\Field\FieldFormatter\ResponsiveImageFormatter::__construct()
- 9 core/modules/responsive_image/src/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php \Drupal\responsive_image\Plugin\Field\FieldFormatter\ResponsiveImageFormatter::__construct()
- 8.9.x core/modules/responsive_image/src/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php \Drupal\responsive_image\Plugin\Field\FieldFormatter\ResponsiveImageFormatter::__construct()
Constructs a FormatterBase object.
Parameters
string $plugin_id: The plugin ID for the formatter.
mixed $plugin_definition: The plugin implementation definition.
\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The definition of the field to which the formatter is associated.
array $settings: The formatter settings.
string $label: The formatter label display setting.
string $view_mode: The view mode.
array $third_party_settings: Any third party settings.
Overrides FormatterBase::__construct
File
-
core/
modules/ responsive_image/ src/ Plugin/ Field/ FieldFormatter/ ResponsiveImageFormatter.php, line 38
Class
- ResponsiveImageFormatter
- Plugin for responsive image formatter.
Namespace
Drupal\responsive_image\Plugin\Field\FieldFormatterCode
public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, array $third_party_settings, protected EntityStorageInterface $responsiveImageStyleStorage, protected EntityStorageInterface $imageStyleStorage, protected LinkGeneratorInterface $linkGenerator, protected AccountInterface $currentUser, ?FileUrlGeneratorInterface $fileUrlGenerator = NULL) {
parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $label, $view_mode, $third_party_settings);
if (!$fileUrlGenerator) {
@trigger_error('Calling ResponsiveImageFormatter::__construct() without the $fileUrlGenerator argument is deprecated in drupal:11.4.0 and the $fileUrlGenerator argument will be required in drupal:12.0.0. See https://www.drupal.org/node/3291487', E_USER_DEPRECATED);
$fileUrlGenerator = \Drupal::service('file_url_generator');
}
$this->fileUrlGenerator = $fileUrlGenerator;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.