Skip to content
Snippets Groups Projects
Commit 02ee2219 authored by Eric Bremner's avatar Eric Bremner
Browse files

ISTWCMS-6860: fix the event styling for automatic list block

parent ffb05080
No related branches found
No related tags found
1 merge request!247ISTWCMS-6860: fix the event styling for automatic list block
......@@ -369,21 +369,25 @@ class UwBlockAutoRender {
if (isset($config['date'])) {
$date = $config['date'];
if ($date === 'now') {
// Use event_block_current block display.
$view->setDisplay('event_block_current');
$display_id = 'event_block_current';
}
elseif ($date === 'past') {
// Use event_block_past block display.
$view->setDisplay('event_block_past');
$display_id = 'event_block_past';
}
elseif ($date === 'all') {
// Use event_block_all block display.
$view->setDisplay('event_block_all');
$display_id = 'event_block_all';
}
elseif ($date === 'range') {
if (isset($config['from']) && isset($config['to'])) {
// Use event_block_range block display.
$view->setDisplay('event_block_range');
$display_id = 'event_block_range';
// Get 'from' and 'to' inputs.
$from = gmdate("Y-m-d", $config['from']->getTimestamp());
......@@ -412,9 +416,12 @@ class UwBlockAutoRender {
}
// For existing site without date field.
else {
$view->setDisplay('events_listing_block');
$display_id = 'events_listing_block';
}
// Set the display id for the view.
$view->setDisplay($display_id);
// The filters to be used in the view.
$filters_to_use = [
'tags' => 'field_uw_event_tags_target_id',
......@@ -456,13 +463,15 @@ class UwBlockAutoRender {
// Execute the view.
$view->execute();
// Get the render array.
// Return the render array for the view.
return [
'#theme' => 'uw_block_views_list',
'#items' => [
'view' => $view->render(),
'type' => 'view',
],
'#type' => 'view',
'#name' => 'view_name',
'#view' => $view,
'#display_id' => $display_id,
'#embed' => TRUE,
'#cache' => $view->getCacheTags(),
];
}
......
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