Files
cdesai_emulsify/templates/fields/field--node--field-daterange--teaser.html.twig

27 lines
849 B
Twig

{% macro display_date(date_content, attributes) %}
{% set rendered = date_content|render|striptags|trim %}
{% set dates = rendered|split(',') %}
{% include '@components/teaser/teaser--event/_teaser-date.twig' with {
teaser_start: dates.0|trim,
teaser_end: dates|length > 1 ? dates.1|trim : false,
drupal_attributes: attributes|without('class'),
modifier_classes: attributes.class|join(' ')|trim
} %}
{% endmacro %}
{% if label_display == 'visually_hidden' %}
<div{{ title_attributes.addClass('visually-hidden') }}>{{ label }}</div>
{% endif %}
{% if multiple %}
<div{{ attributes }}>
{% for item in items %}
{{ _self.display_date(item.content, item.attributes) }}
{% endfor %}
</div>
{% else %}
{% for item in items %}
{{ _self.display_date(item.content, attributes) }}
{% endfor %}
{% endif %}