Skip to content
Snippets Groups Projects
Commit de30f8b5 authored by Owen Bush's avatar Owen Bush Committed by Owen Bush
Browse files

Issue #3135007 by owenbush, virtualwaves: "Events in Series" not linked to...

Issue #3135007 by owenbush, virtualwaves: "Events in Series" not linked to referenced entity causes unexpected error
parent bceaf3aa
No related branches found
No related tags found
No related merge requests found
...@@ -139,6 +139,7 @@ class EventInstanceDateFormatter extends EntityReferenceFormatterBase { ...@@ -139,6 +139,7 @@ class EventInstanceDateFormatter extends EntityReferenceFormatterBase {
'#title' => $date_string, '#title' => $date_string,
'#url' => $uri, '#url' => $uri,
'#options' => $uri->getOptions(), '#options' => $uri->getOptions(),
'#eventinstance' => $entity,
]; ];
if (!empty($items[$delta]->_attributes)) { if (!empty($items[$delta]->_attributes)) {
...@@ -150,14 +151,17 @@ class EventInstanceDateFormatter extends EntityReferenceFormatterBase { ...@@ -150,14 +151,17 @@ class EventInstanceDateFormatter extends EntityReferenceFormatterBase {
} }
} }
else { else {
$elements[$delta] = ['#plain_text' => $date_string]; $elements[$delta] = [
'#plain_text' => $date_string,
'#eventinstance' => $entity,
];
} }
$elements[$delta]['#cache']['tags'] = $entity->getCacheTags(); $elements[$delta]['#cache']['tags'] = $entity->getCacheTags();
} }
usort($elements, function ($a, $b) { usort($elements, function ($a, $b) {
$a_date = $a['#options']['entity']->date->start_date->getTimestamp(); $a_date = $a['#eventinstance']->date->start_date->getTimestamp();
$b_date = $b['#options']['entity']->date->start_date->getTimestamp(); $b_date = $b['#eventinstance']->date->start_date->getTimestamp();
if ($a_date == $b_date) { if ($a_date == $b_date) {
return 0; return 0;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment