|
|
@ -61,34 +61,35 @@ function reserve_form_reserve_reservation_form_alter(array &$form, FormStateInte |
|
|
|
$year = reserve_which_year($month, $day); |
|
|
|
$year = reserve_which_year($month, $day); |
|
|
|
$yyyymmdd = date('Y-m-d', strtotime($year . '-' . $month . '-' . $day)); |
|
|
|
$yyyymmdd = date('Y-m-d', strtotime($year . '-' . $month . '-' . $day)); |
|
|
|
$d = $yyyymmdd . ' 00:00:00'; |
|
|
|
$d = $yyyymmdd . ' 00:00:00'; |
|
|
|
} |
|
|
|
|
|
|
|
if(reserve_daily_max_exceeded($yyyymmdd)) { |
|
|
|
if (reserve_daily_max_exceeded($yyyymmdd)) { |
|
|
|
$form = array(); |
|
|
|
$form = array(); |
|
|
|
$form['message'] = [ |
|
|
|
$form['message'] = [ |
|
|
|
'#type' => 'markup', |
|
|
|
'#type' => 'markup', |
|
|
|
'#weight' => -25, |
|
|
|
'#weight' => -25, |
|
|
|
'#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'. |
|
|
|
'You have exceeded the max number of daily bookings. Unable to add reservation' . |
|
|
|
'</div></div>', |
|
|
|
'</div></div>', |
|
|
|
]; |
|
|
|
]; |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
$config = \Drupal::config('reserve.settings'); |
|
|
|
$config = \Drupal::config('reserve.settings'); |
|
|
|
$max_per_user = $config->get('reservations_per_user'); |
|
|
|
$max_per_user = $config->get('reservations_per_user'); |
|
|
|
if(count(reserve_user_reservations()) > $max_per_user){ |
|
|
|
if (count(reserve_user_reservations()) > $max_per_user) { |
|
|
|
$form = array(); |
|
|
|
$form = array(); |
|
|
|
$form['message'] = [ |
|
|
|
$form['message'] = [ |
|
|
|
'#type' => 'markup', |
|
|
|
'#type' => 'markup', |
|
|
|
'#weight' => -25, |
|
|
|
'#weight' => -25, |
|
|
|
'#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'. |
|
|
|
'You have exceeded your max number of open bookings. Unable to add reservation' . |
|
|
|
'</div></div>', |
|
|
|
'</div></div>', |
|
|
|
]; |
|
|
|
]; |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
$entity = \Drupal::entityTypeManager()->getStorage($entity_type)->load($eid); |
|
|
|
$entity = \Drupal::entityTypeManager()->getStorage($entity_type)->load($eid); |
|
|
|
$bundle = $entity->bundle(); |
|
|
|
$bundle = $entity->bundle(); |
|
|
|