Skip to content

Commit

Permalink
Merge pull request #895 from City-of-Helsinki/UHF-X_curated_events_wh…
Browse files Browse the repository at this point in the history
…itescreen

UHF-X: External event entity causes WSOD fix
  • Loading branch information
rpnykanen authored Jan 28, 2025
2 parents 45bcca1 + 3b4baf2 commit b60ca83
Showing 1 changed file with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,28 @@ function helfi_paragraphs_curated_event_list_paragraph_view(
function helfi_paragraphs_curated_event_list_preprocess_external_entity__linkedevents_event(
array &$variables,
): void {
/** @var \Drupal\helfi_paragraphs_curated_event_list\Entity\LinkedEventsEvent $event */
$event = $variables['external_entity'];
$variables['start_timestamp'] = $event->start_time->date->getTimeStamp();
$variables['end_timestamp'] = $event->end_time->date->getTimeStamp();
$start = NULL;
try {
$start = $event->get('start_time')->getValue() ?
$event->get('start_time')->first()->get('date')->getValue()->getTimestamp() :
NULL;
}
catch (\Exception) {
}

$end = NULL;
try {
$end = $event->get('end_time')->getValue() ?
$event->get('end_time')->first()->get('date')->getValue()->getTimestamp() :
NULL;
}
catch (\Exception) {
}

$variables['start_timestamp'] = $start;
$variables['end_timestamp'] = $end;
}

/**
Expand Down

0 comments on commit b60ca83

Please sign in to comment.