function bat_event_permission in Booking and Availability Management Tools for Drupal 7
Implements hook_permission().
File
- modules/
bat_event/ bat_event.module, line 236 - Manage Events - Events store the EventValue of a Unit over a period of time.
Code
function bat_event_permission() {
$permissions = array(
'administer bat_event_type entities' => array(
'title' => t('Administer event types'),
'description' => t('Allows users to add event types and configure their fields.'),
'restrict access' => TRUE,
),
);
$entity_info = entity_get_info('bat_event');
$labels = $entity_info['permission labels'];
if (!empty($entity_info['entity keys']['bundle'])) {
foreach ($entity_info['bundles'] as $bundle_name => $bundle_info) {
$permissions['view calendar data for any ' . $bundle_name . ' event'] = array(
'title' => t('View calendar data for any %bundle @entity_type', array(
'@entity_type' => $labels['plural'],
'%bundle' => $bundle_info['label'],
)),
);
}
}
return $permissions + bat_entity_access_permissions('bat_event');
}