Browse Source

added a message when a user clicks to far into the future and made some string translatable

d9
ppound 3 years ago
parent
commit
864c8b9d62
  1. 4
      reservation.inc
  2. 4
      src/Controller/CalendarController.php

4
reservation.inc

@ -70,7 +70,7 @@ function reserve_form_reserve_reservation_form_alter(array &$form, FormStateInte
'#markup' => ' '#markup' => '
<div class="messages__wrapper layout-container"> <div class="messages__wrapper layout-container">
<div role="contentinfo" aria-label="Warning message" class="messages messages--warning">' . <div role="contentinfo" aria-label="Warning message" class="messages messages--warning">' .
'You have exceeded the max number of daily bookings. Unable to add reservation' . t('You have exceeded the max number of daily bookings. Unable to add reservation.') .
'</div></div>', '</div></div>',
]; ];
return; return;
@ -85,7 +85,7 @@ function reserve_form_reserve_reservation_form_alter(array &$form, FormStateInte
'#markup' => ' '#markup' => '
<div class="messages__wrapper layout-container"> <div class="messages__wrapper layout-container">
<div role="contentinfo" aria-label="Warning message" class="messages messages--warning">' . <div role="contentinfo" aria-label="Warning message" class="messages messages--warning">' .
'You have exceeded your max number of open bookings. Unable to add reservation' . t('You have exceeded your max number of open bookings. Unable to add reservation.') .
'</div></div>', '</div></div>',
]; ];
return; return;

4
src/Controller/CalendarController.php

@ -44,6 +44,7 @@ class CalendarController extends ControllerBase {
// likely no need for this as not used anywhere else; but maybe for external modules // likely no need for this as not used anywhere else; but maybe for external modules
global $yyyy_mmdd; global $yyyy_mmdd;
//$entity_type = ebundle_split($ebundle, 'type'); //$entity_type = ebundle_split($ebundle, 'type');
//$bundle = ebundle_split($ebundle, 'bundle'); //$bundle = ebundle_split($ebundle, 'bundle');
$category_field = reserve_category_fields($ebundle); $category_field = reserve_category_fields($ebundle);
@ -75,6 +76,9 @@ class CalendarController extends ControllerBase {
if ($yyyy_mmdd == $dates[0]['yyyymmdd']) { if ($yyyy_mmdd == $dates[0]['yyyymmdd']) {
$dates[0]['selected'] = TRUE; $dates[0]['selected'] = TRUE;
$dates[0]['today'] = TRUE; $dates[0]['today'] = TRUE;
\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.'));
} }
// a bit hacky; but we need to store what the calendar is using for its date so we can use this in theme functions later // a bit hacky; but we need to store what the calendar is using for its date so we can use this in theme functions later

Loading…
Cancel
Save