You are here

protected function ConnectionPermissions::buildPermissions in RedHen CRM 8

Builds a standard list of permissions for a given Connection type.

Parameters

\Drupal\redhen_connection\Entity\ConnectionType $connection_type: The machine name of the Connection type.

Return value

array An array of permission names and descriptions.

1 call to ConnectionPermissions::buildPermissions()
ConnectionPermissions::ConnectionTypePermissions in modules/redhen_connection/src/ConnectionPermissions.php
Returns an array of RedHen Connection type permissions.

File

modules/redhen_connection/src/ConnectionPermissions.php, line 38

Class

ConnectionPermissions

Namespace

Drupal\redhen_connection

Code

protected function buildPermissions(ConnectionType $connection_type) {
  $type_id = $connection_type
    ->id();
  $type_params = [
    '%type' => $connection_type
      ->label(),
  ];
  return [
    "add {$type_id} connection" => [
      'title' => $this
        ->t('%type: Add connection', $type_params),
    ],
    "view active {$type_id} connection" => [
      'title' => $this
        ->t('%type: View active connections', $type_params),
    ],
    "view inactive {$type_id} connection" => [
      'title' => $this
        ->t('%type: View inactive connections', $type_params),
    ],
    "edit {$type_id} connection" => [
      'title' => $this
        ->t('%type: Edit connections', $type_params),
    ],
    "delete {$type_id} connection" => [
      'title' => $this
        ->t('%type: Delete connections', $type_params),
    ],
  ];
}