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 @@