You are here

public function MetatagPermissions::permissions in Metatag 8

Get each permission.

Return value

array Permissions array.

1 string reference to 'MetatagPermissions::permissions'
metatag_extended_perms.permissions.yml in metatag_extended_perms/metatag_extended_perms.permissions.yml
metatag_extended_perms/metatag_extended_perms.permissions.yml

File

metatag_extended_perms/src/MetatagPermissions.php, line 63

Class

MetatagPermissions
Provides dynamic permissions for the Metatag module.

Namespace

Drupal\metatag_extended_perms

Code

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

  // Build permissions for each tag in each group.
  foreach ($this->tagManager
    ->getDefinitions() as $key => $metatag) {
    $group = $this->groupManager
      ->getDefinition($metatag['group']);
    $permissions += [
      'access metatag ' . $metatag['group'] . '__' . $key => [
        'title' => $this
          ->t('Access %tag in %group', [
          '%tag' => $metatag['label'],
          '%group' => $group['label'],
        ]),
      ],
    ];
  }
  return $permissions;
}