Browse Source

more updates for drupal 9

d9
ppound 4 years ago
parent
commit
279d63fe4a
  1. 2
      reservation.inc
  2. 2
      reserve.inc
  3. 6
      reserve.series.inc
  4. 3
      src/Controller/CalendarController.php

2
reservation.inc

@ -63,7 +63,7 @@ function reserve_form_reserve_reservation_form_alter(array &$form, FormStateInte
$d = $yyyymmdd . ' 00:00:00'; $d = $yyyymmdd . ' 00:00:00';
} }
$entity = entity_load($entity_type, $eid); $entity = \Drupal::entityTypeManager()->getStorage($entity_type)->load($eid);
$bundle = $entity->bundle(); $bundle = $entity->bundle();
$date = date('l, M d, Y', strtotime($d)); $date = date('l, M d, Y', strtotime($d));
$time = reserve_display_time($t); $time = reserve_display_time($t);

2
reserve.inc

@ -1115,7 +1115,7 @@ function reserve_which_year($month, $day) {
* used for Allowed Values for Reservation.reservable_content_type field * used for Allowed Values for Reservation.reservable_content_type field
*/ */
function reserve_site_entity_types() { function reserve_site_entity_types() {
$types = \Drupal::entityManager()->getEntityTypeLabels(TRUE); $types = \Drupal::service('entity_type.repository')->getEntityTypeLabels(TRUE);
return $types['Content']; return $types['Content'];
} }

6
reserve.series.inc

@ -36,7 +36,8 @@ function reserve_reserve_reservation_insert($entity) {
$length = $entity->reservation_length->getString(); $length = $entity->reservation_length->getString();
$rid = $entity->reservable_id->getString(); $rid = $entity->reservable_id->getString();
$rtype = $entity->reservable_content_type->getString(); $rtype = $entity->reservable_content_type->getString();
$ebundle = $rtype . '.' . entity_load($rtype, $rid)->bundle(); $ebundle = $rtype . '.' . \Drupal::entityTypeManager()
->getStorage($rtype)->load($id)->bundle();
$day = date('l', strtotime($start)); $day = date('l', strtotime($start));
$msg = ''; $msg = '';
@ -122,7 +123,8 @@ function reserve_reserve_reservation_update($entity) {
$length = $entity->reservation_length->getString(); $length = $entity->reservation_length->getString();
$rid = $entity->reservable_id->getString(); $rid = $entity->reservable_id->getString();
$rtype = $entity->reservable_content_type->getString(); $rtype = $entity->reservable_content_type->getString();
$ebundle = $rtype . '.' . entity_load($rtype, $rid)->bundle(); $ebundle = $rtype . '.' . \Drupal::entityTypeManager()
->getStorage($rtype)->load($id)->bundle();
$private = $entity->reservation_private->getString(); $private = $entity->reservation_private->getString();
// grab all reservations in this series except the one being submitted // grab all reservations in this series except the one being submitted

3
src/Controller/CalendarController.php

@ -496,7 +496,8 @@ class CalendarController extends ControllerBase {
// The time slot has a reservation that can be edited by the current user. // The time slot has a reservation that can be edited by the current user.
if ($id = $reservations[$rid][$time]['id']) { if ($id = $reservations[$rid][$time]['id']) {
$reservation = entity_load('reserve_reservation', $id); $reservation = \Drupal::entityTypeManager()
->getStorage('reserve_reservation')->load($id);
$viewable_class = $reservation->access('update') ? 'viewable' : ''; $viewable_class = $reservation->access('update') ? 'viewable' : '';
if ($viewable_class == 'viewable') { if ($viewable_class == 'viewable') {
$options = array_merge_recursive($modal, array( $options = array_merge_recursive($modal, array(

Loading…
Cancel
Save