Skip to content
Snippets Groups Projects
Commit ddbbdd30 authored by wodby's avatar wodby
Browse files

ISTWCMS-5088: showing all dates on node page

parent b8af36b9
No related branches found
No related tags found
1 merge request!147ISTWCMS-5088: showing all dates on node page
......@@ -350,7 +350,7 @@ class UWService implements UWServiceInterface {
break;
case 'date':
$node_data['date'] = $this->uwGetDates($node, $data);
$node_data['date'] = $this->uwGetDates($node, $data, $view_mode);
break;
case 'audience':
......@@ -606,7 +606,7 @@ class UWService implements UWServiceInterface {
/**
* {@inheritDoc}
*/
public function uwGetDates(Node $node, string $field_name): array {
public function uwGetDates(Node $node, string $field_name, string $view_mode): array {
$return_dates = [];
......@@ -637,11 +637,22 @@ class UWService implements UWServiceInterface {
// out correct values.
foreach ($dates as $date) {
// Ensure that the dates are greater than timestamp
// that we generated above.
if ($date['end_value'] > $check_date) {
// ISTWCMS-5088: we need to ensure that at least
// some dates show on the node page, so let's just
// display them all.
// If not node page, only get dates in the future.
if ($view_mode == 'full') {
$return_dates[] = $this->UwGetDate($date, 'event');
}
else {
// Ensure that the dates are greater than timestamp
// that we generated above.
if ($date['end_value'] > $check_date) {
$return_dates[] = $this->UwGetDate($date, 'event');
}
}
}
}
......
......@@ -87,11 +87,13 @@ interface UWServiceInterface {
* Node entity.
* @param string $field_name
* The field name that has the date(s).
* @param string $view_mode
* The view mode of the node.
*
* @return array
* Array of dates.
*/
public function uwGetDates(Node $node, string $field_name): array;
public function uwGetDates(Node $node, string $field_name, string $view_mode): array;
/**
* Get a date in the proper format.
......
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