Issue #3396519: Add a responsive image formatter for media fields.
3 unresolved threads
There is no responsive image formatter available for media fields.
This change adds a responsive image formatter for media fields.
Merge request reports
Activity
23 */ 24 #[FieldFormatter( 25 id: 'media_responsive_thumbnail', 26 label: new TranslatableMarkup('Responsive thumbnail'), 27 field_types: [ 28 'entity_reference', 29 ], 30 )] 31 class MediaResponsiveThumbnailFormatter extends ResponsiveImageFormatter { 32 33 /** 34 * The renderer service. 35 * 36 * @var \Drupal\Core\Render\RendererInterface 37 */ 38 protected $renderer; changed this line in version 2 of the diff
61 * @param \Drupal\Core\Utility\LinkGeneratorInterface $link_generator 62 * The link generator service. 63 * @param \Drupal\Core\Session\AccountInterface $current_user 64 * The current user. 65 * @param \Drupal\Core\Render\RendererInterface $renderer 66 * The renderer service. 67 */ 68 public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, array $third_party_settings, EntityStorageInterface $responsive_image_style_storage, EntityStorageInterface $image_style_storage, LinkGeneratorInterface $link_generator, AccountInterface $current_user, RendererInterface $renderer) { 69 parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $label, $view_mode, $third_party_settings, $responsive_image_style_storage, $image_style_storage, $link_generator, $current_user); 70 $this->renderer = $renderer; 71 } 72 73 /** 74 * {@inheritdoc} 75 */ 76 public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { changed this line in version 2 of the diff
changed this file in version 2 of the diff
added 1 commit
- 8e0aa6a5 - Updating to use constructor promotion and adding missing return types.
added 1 commit
- 561ec37e - Adding the media responsive thumbnail formatter settings schema.
added 1 commit
- f12d5e03 - Adding the MediaResponsiveThumbnailFormatterTest functional test.
added 1 commit
- 5ace7ae3 - Adding the MediaResponsiveThumbnailFormatterTest kernel test.
Please register or sign in to reply