Skip to content
Snippets Groups Projects
Commit e58d1f9d authored by ytsurk's avatar ytsurk
Browse files

Issue #3322824 by rang501, Raphael Apard: Alt attribute lost when using Image...

Issue #3322824 by rang501, Raphael Apard: Alt attribute lost when using Image with dimensions plugin
parent be2e8ce1
No related branches found
Tags 7.x-2.3
No related merge requests found
......@@ -217,12 +217,14 @@ class MediaDirectoriesImageDimensionsFormatter extends MediaThumbnailFormatter {
foreach ($media_items as $delta => $media) {
/** @var \Drupal\file\Entity\File $file */
$file = $media->get('thumbnail')->entity;
$alt = $media->get('thumbnail')->alt;
$elements[$delta] = [
'#theme' => 'image',
'#attributes' => [
'width' => $this->getSetting('dimensions')['image_width'],
'height' => $this->getSetting('dimensions')['image_height'],
'alt' => $alt,
'class' => [],
],
'#uri' => $this->fileUrlGenerator->generateAbsoluteString($file->getFileUri()),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment