Skip to content
Merged
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
38 changes: 18 additions & 20 deletions templates/content/external-entity--linkedevents-event.html.twig
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
{% set is_multidate = start_timestamp|date('Y-m-d') != end_timestamp|date('Y-m-d') %}
{% set same_year = start_timestamp|date('Y') == end_timestamp|date('Y') %}
{% set html_start = start_timestamp|format_date('custom', 'Y-m-d') ~ 'T' ~ start_timestamp|format_date('custom', 'H:i') %}
{% set html_end = end_timestamp|format_date('custom', 'Y-m-d') ~ 'T' ~ end_timestamp|format_date('custom', 'H:i') %}

{% if is_multidate and not same_year %}
{% set card_start_timestamp = start_timestamp|date('d.m.Y')%}
{% set card_end_timestamp = end_timestamp|date('d.m.Y')%}
{% elseif is_multidate %}
{% set card_start_timestamp = start_timestamp|date('d.m.')%}
{% set card_end_timestamp = end_timestamp|date('d.m.Y')%}
{% else %}
{% set card_start_timestamp = start_timestamp|format_date('publication_date_format') %}
{% set card_end_timestamp = end_timestamp|format_date('custom', 'H:i') %}
{% if start_timestamp and end_timestamp is not null %}
{% set is_multidate = start_timestamp|date('Y-m-d') != end_timestamp|date('Y-m-d') %}
{% set same_year = start_timestamp|date('Y') == end_timestamp|date('Y') %}
{% set card_start_timestamp = is_multidate and not same_year
? start_timestamp|date('d.m.Y')
: is_multidate
? start_timestamp|date('d.m.')
: start_timestamp|format_date('publication_date_format') %}
{% set card_end_timestamp = is_multidate
? end_timestamp|date('d.m.Y')
: end_timestamp|format_date('custom', 'H:i') %}
{% set html_start = start_timestamp|format_date('custom', 'Y-m-d') ~ 'T' ~ start_timestamp|format_date('custom', 'H:i') %}
{% set html_end = end_timestamp|format_date('custom', 'Y-m-d') ~ 'T' ~ end_timestamp|format_date('custom', 'H:i') %}
{% endif %}


{% embed '@hdbt/component/card-teaser.twig' with {
card_image: content.main_image,
card_title: content.external_link[0]['#title'],
card_url: content.external_link[0]['#url'],
card_has_start_and_end: true,
card_start_timestamp: card_start_timestamp,
card_end_timestamp: card_end_timestamp,
card_html_start: html_start,
card_html_end: html_end,
card_has_start_and_end: start_timestamp and end_timestamp is not null,
card_start_timestamp: card_start_timestamp|default(null),
card_end_timestamp: card_end_timestamp|default(null),
card_html_start: html_start|default(null),
card_html_end: html_end|default(null),
} %}
{% endembed %}
Loading