Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SGD8-2503: Change html for Partners block #949

Merged
merged 4 commits into from
Sep 20, 2023
Merged
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
16 changes: 12 additions & 4 deletions templates/contrib/paragraphs/paragraph--partners.html.twig
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{#
/**
* @file
* Theme implementation to display a links paragraph (list of link paragraphs).
* Default theme implementation to display a paragraph.
*
* Available variables:
* - grid_size: The number of items in each grid row.
* - paragraph: Full paragraph entity.
* Only method names starting with "get", "has", or "is" and a few common
* methods such as "id", "label", and "bundle" are available. For example:
Expand Down Expand Up @@ -40,17 +39,22 @@
*/
#}

{% if content.field_paragraphs['#items']|length == 1 %}
{% set single_partner = true %}
{% endif %}

{% set classes = [
'paragraph',
'paragraph--type--' ~ paragraph.bundle|clean_class,
view_mode ? 'paragraph--view-mode--' ~ view_mode|clean_class,
not paragraph.isPublished() ? 'paragraph--unpublished',
'partner-block',
content.field_paragraphs['#is_multiple'] ? 'partner__multiple' : 'partner__single',
single_partner ? 'partner__single' : 'partner__multiple',
] %}

{% block paragraph %}
<div{{ attributes.addClass(classes) }}>
{% if (content.title|render|striptags|trim is not empty) or (content.field_text|render|striptags|trim is not empty) %}
<div class="partner-content intro">
<div class="intro__content">
{% block title %}
Expand All @@ -59,9 +63,13 @@
{% endif %}
{% endblock %}

{{ content.field_text }}
{% if content.field_text|render|striptags|trim is not empty %}
{{ content.field_text }}
{% endif %}
</div>
</div>
{% endif %}

<div class="partner-content partners">
{% block content %}
{{ content.field_paragraphs }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
#}

{% if items|length > 1 %}
<ul{{ attributes.addClass('inline') }}>
<ul{{ attributes.addClass('inline') }}>
{% for item in items %}
<li{{ item.attributes }}>{{ item.content }}</li>
{% endfor %}
</ul>
{% else %}
{% for item in items %}
<li{{ item.attributes }}>{{ item.content }}</li>
<div{{ item.attributes }}>{{ item.content }}</div>
{% endfor %}
</ul>
{% else %}
{% for item in items %}
{{ item.content }}
{% endfor %}
{% endif %}