zurb_foundation_6_paragraphs-1.0.1-beta1/templates/cell/paragraph--foundation-cell.html.twig
templates/cell/paragraph--foundation-cell.html.twig
{##
# Twig for the Foundation Cell paragraphs
# Based on the Zurb Foundation XY Grid (https://get.foundation/sites/docs/xy-grid.html)
# Based on the Zurb Foundation Flexbox Utilities classes (https://get.foundation/sites/docs/flexbox-utilities.html)
#}
{%
set classes = [
'paragraph',
'paragraph--type--' ~ paragraph.bundle|clean_class,
view_mode ? 'paragraph--view-mode--' ~ view_mode|clean_class,
'paragraphId-' ~ paragraph.id(),
'cell'
]
%}
{# Get the fields to define the background #}
{% set bgAttributes = create_attribute() %}
{% set bgColor = (content.field_foundation_bg_color[0] is defined) ? content.field_foundation_bg_color[0]['#markup'] : '' %}
{% set bgImage = (content.field_foundation_bg_image[0] is defined) ? content.field_foundation_bg_image[0]['#markup'] : '' %}
{% set bgExpLeft = (content.field_foundation_bg_exp_left[0] is defined) ? content.field_foundation_bg_exp_left[0]['#markup']|number_format : 0 %}
{% set bgExpRight = (content.field_foundation_bg_exp_right[0] is defined) ? content.field_foundation_bg_exp_right[0]['#markup']|number_format : 0 %}
{# Define the classes for the background #}
{% set bgClasses = [
'backgroundDiv',
'backgroundCellDiv',
(bgColor != '') ? 'colorBg' : '',
(bgColor != '') ? 'colorBg-' ~ bgColor : '',
(bgImage != '') ? 'imageBg' : '',
(bgExpLeft == 1) ? 'expendedBgLeft' : '',
(bgExpRight == 1) ? 'expendedBgRight' : '',
] %}
{% block paragraph %}
<div{{ attributes.addClass(classes) }}>
{% block content %}
{% if (bgColor != '') or (bgImage != '') %}
<div{{ bgAttributes.addClass(bgClasses) }} style="background-image: url('{{ bgImage }}');"></div>
{% endif %}
{{ content.field_foundation_elements }}
{% endblock %}
</div>
{% endblock paragraph %}
