Browse Source

made logic for the date to far in the future message more foolproof

d9
ppound 3 years ago
parent
commit
369917ce79
  1. 6
      src/Controller/CalendarController.php

6
src/Controller/CalendarController.php

@ -68,15 +68,19 @@ class CalendarController extends ControllerBase {
// Determine which day has been selected by the user. If the user has entered a url that specifies a day outside of the
// allowable reservation window, then set the current day as the selected day.
$yyyy_mmdd = $dates[0]['yyyymmdd'];
$day_selected = false;
foreach ($dates as $day) {
if ($day['selected']) {
$yyyy_mmdd = $day['yyyymmdd'];
$day_selected = TRUE;
}
}
if ($yyyy_mmdd == $dates[0]['yyyymmdd']) {
$dates[0]['selected'] = TRUE;
$dates[0]['today'] = TRUE;
\Drupal::messenger()->addWarning(t('You have chosen a date to far in the '
}
if(!$day_selected) {
\Drupal::messenger()->addWarning(t('You have chosen a date to far in the '
. 'future. Please choose a date within 14 days of today. The Calendar'
. ' view below has defaulted to todays date.'));
}

Loading…
Cancel
Save