drowl_paragraphs_bs-1.x-dev/modules/drowl_paragraphs_bs_type_layout/templates/paragraph--drowl-paragraphs-bs--layout.html.twig
modules/drowl_paragraphs_bs_type_layout/templates/paragraph--drowl-paragraphs-bs--layout.html.twig
{% extends "@drowl_paragraphs_bs/paragraph--drowl-paragraphs-bs.html.twig" %}
{# Set onepage options #}
{% if paragraph.field_anchor_title.0 %}
{% set container_anchor_menu_title = paragraph.get('field_anchor_title').value %}
{# @todo: If id is set in paragraphs settings > expert, use this id instead of the generated id by the title #}
{#% set container_anchor_target_id = paragraph.get('field_anchor_id').value|default(container_anchor_menu_title)|trim|clean_class %#}
{% set container_anchor_target_id = container_anchor_menu_title|clean_class %}
{% if container_anchor_target_id|length > 0 %}
{% set attributes = attributes.setAttribute('id', container_anchor_target_id) %}
{% endif %}
{% if container_anchor_menu_title|length > 0 %}
{% set attributes = attributes.setAttribute('data-scrollspy-target', container_anchor_target_id|clean_class).setAttribute('data-scrollspy-title', container_anchor_menu_title) %}
{% endif %}
{% endif %}
{%
set container_classes = [
'paragraph',
'paragraph--type-' ~ paragraph.bundle|clean_class,
paragraph.field_link.0.url ? 'has-overlay-link',
content.field_paragraphs['#items']|length > 1 ? 'equal-height-childs'
]
%}
{% block paragraph %}
{# ======== Background image variables ======== #}
{% set background_image_classes = [
has_background_media ? 'drowl-background-media',
(has_background_media and background_media_entity_bundle) ? 'drowl-background-image--bundle-' ~ background_media_entity_bundle|clean_class,
elements.regions['#settings'].layout.container_width == 'page-width' ? 'container',
elements.regions['#settings'].layout.container_max_width ?: elements.regions['#settings'].layout.container_max_width
]
%}
{# Merge custom classes set by the user #}
{% if paragraph.field_bgimage_classes.0 %}
{% set background_image_classes = background_image_classes|merge(paragraph.field_bgimage_classes.value|split(' ')) %}
{% endif %}
{# ======== END Background image variables ======== #}
{% if background_image_classes %}
{% set container_classes = container_classes|merge(background_image_classes) %}
{% endif %}
<div{{ attributes.addClass(container_classes) }}>
{# Get fancy background image container markup #}
{{ include('@drowl_paragraphs_bs/inc/drowl_background_image.html.twig') }}
{# Overlay link #}
{% if paragraph.field_link.0 is not empty %}
{% set paragraph_overlay_link = paragraph.field_link[0] %}
<a class="container-overlay-link overlay-link {{ paragraph_overlay_link.url.options.attributes.class|join(' ') }}" title="{{ paragraph_overlay_link.title }}" href="{{ paragraph_overlay_link.url.toString }}" {% if paragraph_overlay_link.url.options.attributes.target %} target="{{ paragraph_overlay_link.url.options.attributes.target }}" {% endif %}>
{{ paragraph_overlay_link.title }}
</a>
{% endif %}
{# Add upublished label #}
{{ block("unpublished_hint", "@drowl_paragraphs_bs/paragraph--drowl-paragraphs-bs.html.twig") }}
{% block content %}
{{- content|without('field_background_media', 'field_bgimage_options') -}}
{% endblock content %}
</div>
{% endblock paragraph %}
