You are here

public function EntityQueuePermissions::buildPermissions in Entityqueue 8

Returns a set of permissions for a specific queue.

Parameters

\Drupal\entityqueue\Entity\EntityQueue $queue: An EntityQueue entity.

Return value

array

1 call to EntityQueuePermissions::buildPermissions()
EntityQueuePermissions::permissions in src/EntityQueuePermissions.php
Returns an array of queue permissions.

File

src/EntityQueuePermissions.php, line 38

Class

EntityQueuePermissions
Provides dynamic permissions for the Entityqueue module.

Namespace

Drupal\entityqueue

Code

public function buildPermissions(EntityQueue $queue) {
  $queue_id = $queue
    ->id();
  if ($queue
    ->getHandlerPlugin()
    ->supportsMultipleSubqueues()) {
    $permissions["create {$queue_id} entityqueue"] = [
      'title' => $this
        ->t('Add %queue subqueues', [
        '%queue' => $queue
          ->label(),
      ]),
      'description' => $this
        ->t('Access to create new subqueue to the %queue queue.', [
        '%queue' => $queue
          ->label(),
      ]),
    ];
    $permissions["delete {$queue_id} entityqueue"] = [
      'title' => $this
        ->t('Delete %queue subqueues', [
        '%queue' => $queue
          ->label(),
      ]),
      'description' => $this
        ->t('Access to delete subqueues of the %queue queue.', [
        '%queue' => $queue
          ->label(),
      ]),
    ];
  }
  $permissions["update {$queue_id} entityqueue"] = [
    'title' => $this
      ->t('Manipulate %queue queue', [
      '%queue' => $queue
        ->label(),
    ]),
    'description' => $this
      ->t('Access to update the %queue queue.', [
      '%queue' => $queue
        ->label(),
    ]),
  ];
  return $permissions;
}