You are here

public function UnitPermissions::permissions in Booking and Availability Management Tools for Drupal 8

Returns an array of filter permissions.

Return value

array

1 string reference to 'UnitPermissions::permissions'
bat_unit.permissions.yml in modules/bat_unit/bat_unit.permissions.yml
modules/bat_unit/bat_unit.permissions.yml

File

modules/bat_unit/src/UnitPermissions.php, line 51
Contains \Drupal\bat_unit\UnitPermissions.

Class

UnitPermissions

Namespace

Drupal\bat_unit

Code

public function permissions() {
  $permissions = [];
  $permissions += bat_entity_access_permissions('bat_unit');
  $permissions += bat_entity_access_permissions('bat_unit_type');
  foreach (bat_unit_get_bundles() as $bundle_name => $bundle_info) {
    $permissions['view own bat_unit entities of bundle ' . $bundle_name] = [
      'title' => t('View own published %bundle @entity_bundle', [
        '@entity_bundle' => 'units',
        '%bundle' => $bundle_info
          ->label(),
      ]),
    ];
    $permissions['view any bat_unit entity of bundle ' . $bundle_name] = [
      'title' => t('View any published %bundle @entity_bundle', [
        '@entity_bundle' => 'unit',
        '%bundle' => $bundle_info
          ->label(),
      ]),
    ];
  }
  foreach (bat_unit_get_type_bundles() as $bundle_name => $bundle_info) {
    $permissions['view own bat_unit_type entities of bundle ' . $bundle_name] = [
      'title' => t('View own published %bundle @entity_bundle', [
        '@entity_bundle' => 'types',
        '%bundle' => $bundle_info
          ->label(),
      ]),
    ];
    $permissions['view any bat_unit_type entity of bundle ' . $bundle_name] = [
      'title' => t('View any published %bundle @entity_bundle', [
        '@entity_bundle' => 'type',
        '%bundle' => $bundle_info
          ->label(),
      ]),
    ];
  }
  return $permissions;
}