You are here

protected function MailingListPermissions::buildPermissions in Mailing List 8

Returns a list of mailing list permissions for a given list.

Parameters

\Drupal\mailing_list\Entity\MailingList $list: The mailing list.

Return value

array An associative array of permission names and descriptions.

1 call to MailingListPermissions::buildPermissions()
MailingListPermissions::mailListPermissions in src/MailingListPermissions.php
Returns an array of mailing list permissions.

File

src/MailingListPermissions.php, line 42

Class

MailingListPermissions
Provides dynamic permissions for each mailing list.

Namespace

Drupal\mailing_list

Code

protected function buildPermissions(MailingList $list) {
  $list_id = $list
    ->id();
  $list_params = [
    '%list_name' => $list
      ->label(),
  ];
  return [
    "subscribe to {$list_id} mailing list" => [
      'title' => $this
        ->t('Subscribe to %list_name mailing list', $list_params),
    ],
    "access inactive {$list_id} mailing list subscriptions" => [
      'title' => $this
        ->t('%list_name: access inactive subscriptions', $list_params),
    ],
    "view any {$list_id} mailing list subscriptions" => [
      'title' => $this
        ->t('%list_name: view any subscriptions', $list_params),
    ],
    "update any {$list_id} mailing list subscriptions" => [
      'title' => $this
        ->t('%list_name: edit any subscriptions', $list_params),
    ],
    "delete any {$list_id} mailing list subscriptions" => [
      'title' => $this
        ->t('%list_name: delete any subscriptions', $list_params),
    ],
  ];
}