You are here

public function EventManagementAccessCheck::access in Booking and Availability Management Tools for Drupal 8

Checks access to the event add page for the event type.

Parameters

\Drupal\Core\Session\AccountInterface $account: The currently logged in account.

Return value

\Drupal\Core\Access\AccessResultInterface The access result.

File

modules/bat_fullcalendar/src/Access/EventManagementAccessCheck.php, line 45
Contains \Drupal\bat_fullcalendar\Access\EventManagementAccessCheck.

Class

EventManagementAccessCheck
Determines access to for event add pages.

Namespace

Drupal\bat_fullcalendar\Access

Code

public function access(AccountInterface $account, $entity_id, $event_type, $event_id, $start_date, $end_date) {
  if ($event_id == 0) {
    return bat_event_access(bat_event_create([
      'type' => $event_type,
    ]), 'create', $account);
  }
  else {
    $event = bat_event_load($event_id);
    return bat_event_access($event, 'update', $account);
  }
}