Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions js/paragraph-rt.js
Original file line number Diff line number Diff line change
@@ -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');
});
24 changes: 14 additions & 10 deletions templates/paragraphs/paragraph--rt.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand All @@ -61,7 +63,8 @@
<div {{ attributes.setAttribute('id', 'paragraph--' ~ paragraph.id() ) }} {{ attributes.addClass(classes) }}>
{% block content %}
{% if column_count == 1 %}
<ilw-content theme="{{ theme }}" width="auto" padding="{{ padding }}">
<ilw-content theme="{{ theme }}" padding="{{ padding }}">
<div class="fixed-width">
{% if content.field_rt_title['#items'] %}
<h2>{{ content.field_rt_title }}</h2>
{% endif %}
Expand All @@ -76,6 +79,7 @@
{{ body|check_markup(body_format) }}
{% endif %}
{% endfor %}
</div>
</ilw-content>
{% else %}
<ilw-content width="auto">
Expand All @@ -90,12 +94,12 @@
{% set body_format= content.field_rt_column[loop.index0]['#paragraph'].field_rt_content_body.format %}
<div>
<ilw-content theme="{{ theme }}">
{% if title %}
<h3>{{ title }}</h3>
{% endif %}
{% if body|trim %}
{{ body|check_markup(body_format) }}
{% endif %}
{% if title %}
<h3>{{ title }}</h3>
{% endif %}
{% if body|trim %}
{{ body|check_markup(body_format) }}
{% endif %}
</ilw-content>
</div>
{% endfor %}
Expand Down