You are here

protected function Permissions::buildPermissions in Scheduled Updates 8

Returns a list of scheduled updates permissions for a given scheduled udpate type.

Parameters

\Drupal\scheduled_updates\entity\ScheduledUpdateType|\Drupal\scheduled_updates\ScheduledUpdateTypeInterface $type: The node type.

Return value

array An associative array of permission names and descriptions. An associative array of permission names and descriptions.

1 call to Permissions::buildPermissions()
Permissions::scheduledUpdateTypesPermissions in src/Permissions.php
Returns an array of node type permissions.

File

src/Permissions.php, line 48
Contains \Drupal\scheduled_updates\Permissions.

Class

Permissions
Provides dynamic permissions for nodes of different types.

Namespace

Drupal\scheduled_updates

Code

protected function buildPermissions(ScheduledUpdateTypeInterface $type) {
  $type_id = $type
    ->id();
  $type_params = array(
    '%type_name' => $type
      ->label(),
  );
  return array(
    "create {$type_id} scheduled updates" => array(
      'title' => $this
        ->t('%type_name: Create new scheduled updates', $type_params),
    ),
    "edit own {$type_id} scheduled updates" => array(
      'title' => $this
        ->t('%type_name: Edit own scheduled updates', $type_params),
    ),
    "edit any {$type_id} scheduled updates" => array(
      'title' => $this
        ->t('%type_name: Edit any scheduled updates', $type_params),
    ),
    "delete own {$type_id} scheduled updates" => array(
      'title' => $this
        ->t('%type_name: Delete own scheduled updates', $type_params),
    ),
    "delete any {$type_id} scheduled updates" => array(
      'title' => $this
        ->t('%type_name: Delete any scheduled updates', $type_params),
    ),
  );
}