Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: City-of-Helsinki/drupal-hdbt
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 6.9.3
Choose a base ref
...
head repository: City-of-Helsinki/drupal-hdbt
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 6.9.4
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Jan 28, 2025

  1. Add null check for the external event template

    teroelonen committed Jan 28, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    8f6754d View commit details
  2. Merge pull request #1169 from City-of-Helsinki/UHF-X_curated_events_w…

    …hitescreen
    
    UHF-X: External event entity causes WSOD fix
    teroelonen authored Jan 28, 2025
    Copy the full SHA
    aa5d861 View commit details
Showing with 18 additions and 20 deletions.
  1. +18 −20 templates/content/external-entity--linkedevents-event.html.twig
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 %}