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
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