From f5f02971fda9ac77314c505371e33c321bc7cf2e Mon Sep 17 00:00:00 2001 From: Alison on Ubuntu on Windows <2660348+alisonjo315@users.noreply.github.com> Date: Tue, 16 Apr 2024 15:25:47 -0400 Subject: [PATCH] add div with attributes back to this template, remove "if content" check For issue #71 (CKEditor 5 inline media image support) --- templates/media/media--image.html.twig | 6 ++++-- templates/media/media.html.twig | 11 ++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/templates/media/media--image.html.twig b/templates/media/media--image.html.twig index bc54833..4fc3ef8 100644 --- a/templates/media/media--image.html.twig +++ b/templates/media/media--image.html.twig @@ -2,6 +2,8 @@ /** * @file * Theme override to display an image media item with WA-compliant description. + * + * In addition to mods in cwd_base/media/media.html.twig: * ~ When field_aria_description has value, this template: * ~~ Adds aria-describedby="description-[MID]" to field_media_image tag. * ~~ Renders field_aria_description inside div#description-[MID].sr-only. @@ -13,7 +15,7 @@ */ #} {{ title_suffix.contextual_links }} -{% if content %} + {% if media.field_aria_description.0.value -%} {% if media.field_media_image.0.value -%} @@ -38,4 +40,4 @@ {{ content }} {%- endif %} -{% endif %} + diff --git a/templates/media/media.html.twig b/templates/media/media.html.twig index e655d40..7db4a02 100644 --- a/templates/media/media.html.twig +++ b/templates/media/media.html.twig @@ -2,7 +2,8 @@ /** * @file * Theme override to display a media item. - * ~ Removed wrapper (ama39) + * ~ Add div with attributes back to this template (we removed it in the past). + * ~ Remove "if content" check. * * Available variables: * - media: The media item, with limited access to object properties and @@ -32,7 +33,7 @@ * @ingroup themeable */ #} - {{ title_suffix.contextual_links }} - {% if content %} - {{ content }} - {% endif %} +{{ title_suffix.contextual_links }} + + {{ content }} +