Skip to content
Snippets Groups Projects
Commit 2e64fa3d authored by Antal Ludescher-Tyukodi's avatar Antal Ludescher-Tyukodi Committed by Wolfgang Ziegler
Browse files

Issue #3063929 by aludescher: Thunder: Don't add empty slots in ParagraphImageProcessor

parent 9046994e
No related branches found
No related tags found
No related merge requests found
......@@ -39,9 +39,15 @@ class ParagraphImageProcessor implements CustomElementProcessorInterface {
/** @var \Drupal\media_entity\Entity\Media $media_entity */
$media_entity = $paragraph->field_image->entity;
$element->setSlot('img', '', 'img', ['src' => $media_entity->field_image->entity->uri->url]);
$element->setSlot('copyright', $media_entity->field_copyright->value, 'p');
$element->setSlot('source', $media_entity->field_source->value, 'p');
$element->setSlot('caption', $media_entity->field_description->value, 'p');
if (!$media_entity->field_copyright->isEmpty()) {
$element->setSlot('copyright', $media_entity->field_copyright->value, 'div');
}
if (!$media_entity->field_source->isEmpty()) {
$element->setSlot('source', $media_entity->field_source->value, 'div');
}
if (!$media_entity->field_description->isEmpty()) {
$element->setSlot('caption', $media_entity->field_description->value, 'div');
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment