You are here

function hook_bat_fullcalendar_formatted_event_alter in Booking and Availability Management Tools for Drupal 8

Same name and namespace in other branches
  1. 7 modules/bat_fullcalendar/bat_fullcalendar.api.php \hook_bat_fullcalendar_formatted_event_alter()

Allow other modules to change calendar events.

Parameters

$formatted_event:

2 invocations of hook_bat_fullcalendar_formatted_event_alter()
FullCalendarFixedStateEventFormatter::format in modules/bat_fullcalendar/src/FullCalendarFixedStateEventFormatter.php
FullCalendarOpenStateEventFormatter::format in modules/bat_fullcalendar/src/FullCalendarOpenStateEventFormatter.php

File

modules/bat_fullcalendar/bat_fullcalendar.api.php, line 46
This file contains no working PHP code; it exists to provide additional documentation for doxygen as well as to document hooks in the standard Drupal manner.

Code

function hook_bat_fullcalendar_formatted_event_alter(&$formatted_event) {

  // Hide booking names for non-privileged users.
  if ($formatted_event['type'] == 'availability' && !\Drupal::currentUser()
    ->hasPermission('create bat_event entities of bundle availability')) {
    if ($formatted_event['blocking']) {
      $formatted_event['title'] = t('Not Available');
      $formatted_event['color'] = '#CC2727';
    }
  }
}