From 315d9b129c4895cefe02ef4ea5ff1dfdfa846c29 Mon Sep 17 00:00:00 2001 From: Natalie Johnstone Date: Mon, 8 Jun 2026 14:47:34 -0500 Subject: [PATCH] fixing the value of the background color in twig, removing width=auto and adding fixed-width class --- js/paragraph-rt.js | 6 +---- templates/paragraphs/paragraph--rt.html.twig | 24 ++++++++++++-------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/js/paragraph-rt.js b/js/paragraph-rt.js index b58eafa7..439e5b82 100644 --- a/js/paragraph-rt.js +++ b/js/paragraph-rt.js @@ -1,7 +1,3 @@ jQuery(function($) { - $('ilw-columns .paragraph--type--rt ilw-content[width="auto"]:not([theme="gray"])').removeAttr('width'); - $('ilw-columns .paragraph--type--rt ilw-content[width="auto"][theme="gray"]').removeAttr('width').attr('padding', '20px 20px 30px'); - $('ilw-columns .paragraph--type--rt ilw-columns[width="auto"]').removeAttr('width'); - $('article.news .paragraph--type--rt ilw-content[width="auto"]').removeAttr('width');//fix for paragraphs in news content type - $('article.spotlight .paragraph--type--rt ilw-content[width="auto"]').removeAttr('width');//fix for paragraphs in spotlight content type + $('ilw-columns .paragraph--type--rt ilw-content[theme="gray"]').attr('padding', '20px 20px 30px'); }); diff --git a/templates/paragraphs/paragraph--rt.html.twig b/templates/paragraphs/paragraph--rt.html.twig index 8720f0a7..8092eb30 100644 --- a/templates/paragraphs/paragraph--rt.html.twig +++ b/templates/paragraphs/paragraph--rt.html.twig @@ -44,12 +44,14 @@ 'paragraph--type--' ~ paragraph.bundle|clean_class, view_mode ? 'paragraph--view-mode--' ~ view_mode|clean_class, not paragraph.isPublished() ? 'paragraph--unpublished', - 'clearfix', 'layout-overflow' + 'clearfix' ] %} {% set column_count = content.field_rt_column['#items']|length %} -{% set background = content.field_rt_background_color['#items'].0.value %} -{% if background == 'Gray' %} +{% set background = paragraph.field_rt_background_color.value|default('')|trim %} +{% set theme = '' %} +{% set padding = '' %} +{% if background|lower == 'gray' %} {% set theme = 'gray' %} {% set padding = '20px 0 30px' %} {% endif %} @@ -61,7 +63,8 @@
{% block content %} {% if column_count == 1 %} - + +
{% if content.field_rt_title['#items'] %}

{{ content.field_rt_title }}

{% endif %} @@ -76,6 +79,7 @@ {{ body|check_markup(body_format) }} {% endif %} {% endfor %} +
{% else %} @@ -90,12 +94,12 @@ {% set body_format= content.field_rt_column[loop.index0]['#paragraph'].field_rt_content_body.format %}
- {% if title %} -

{{ title }}

- {% endif %} - {% if body|trim %} - {{ body|check_markup(body_format) }} - {% endif %} + {% if title %} +

{{ title }}

+ {% endif %} + {% if body|trim %} + {{ body|check_markup(body_format) }} + {% endif %}
{% endfor %}