Commit 42778ca6 authored by Chris Shantz's avatar Chris Shantz
Browse files

Merge branch '1.0.x' into prod/1.0.x

parents 783cac12 4f9a6653
......@@ -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.
......
......@@ -497,11 +497,11 @@ function uw_cfg_common_form_menu_edit_form_alter(array &$form, FormStateInterfac
/**
* Implements hook_form_FORM_ID_alter().
*
* Menu link edit form: admin/structure/menu/link/LINK/edit.
* Menu link edit form: admin/structure/menu/item/ID/edit.
*
* Do not allow the home page to be parent of any item.
*/
function uw_cfg_common_form_menu_link_edit_alter(array &$form, FormStateInterface $form_state, string $form_id): void {
function uw_cfg_common_form_menu_link_content_menu_link_content_form_alter(array &$form, FormStateInterface $form_state, string $form_id): void {
// No changes for those with access.
if (\Drupal::currentUser()->hasPermission('bypass home page protection')) {
return;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment