Skip to content
Snippets Groups Projects

Issue #3396519: Add a responsive image formatter for media fields.

Open Issue #3396519: Add a responsive image formatter for media fields.
3 unresolved threads
Open slbrassard requested to merge issue/drupal-3396519:11.x into 11.x
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

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
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;
  • 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) {
  • slbrassard added 1 commit

    added 1 commit

    • 8e0aa6a5 - Updating to use constructor promotion and adding missing return types.

    Compare with previous version

  • slbrassard added 1 commit

    added 1 commit

    • 561ec37e - Adding the media responsive thumbnail formatter settings schema.

    Compare with previous version

  • slbrassard added 1 commit

    added 1 commit

    • f12d5e03 - Adding the MediaResponsiveThumbnailFormatterTest functional test.

    Compare with previous version

  • slbrassard added 1 commit

    added 1 commit

    • 5ace7ae3 - Adding the MediaResponsiveThumbnailFormatterTest kernel test.

    Compare with previous version

  • Please register or sign in to reply
    Loading