You are here

public function InvitePermissions::permissions in Invite 8

Returns an array of invite permissions.

Return value

array Returns the array with permissions.

1 string reference to 'InvitePermissions::permissions'
invite.permissions.yml in ./invite.permissions.yml
invite.permissions.yml

File

src/InvitePermissions.php, line 47

Class

InvitePermissions
Provides dynamic permissions of the invite module.

Namespace

Drupal\invite

Code

public function permissions() {
  $permissions = [];

  // Generate permissions for each invite type.
  $invite_types = $this->entityTypeManager
    ->getStorage('invite_type')
    ->loadMultiple();
  foreach ($invite_types as $invite_type) {
    $permissions['invite_type_' . $invite_type
      ->getType()] = [
      'title' => $this
        ->t('Create @label invites', [
        '@label' => $invite_type
          ->label(),
      ]),
      'description' => [
        '#prefix' => '<em>',
        '#markup' => $this
          ->t('Warning: This permission could have security implications.'),
        '#suffix' => '</em>',
      ],
    ];
  }
  return $permissions;
}