You are here

public function TaxonomyPermissions::permissions in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/taxonomy/src/TaxonomyPermissions.php \Drupal\taxonomy\TaxonomyPermissions::permissions()

Get taxonomy permissions.

Return value

array Permissions array.

1 string reference to 'TaxonomyPermissions::permissions'
taxonomy.permissions.yml in core/modules/taxonomy/taxonomy.permissions.yml
core/modules/taxonomy/taxonomy.permissions.yml

File

core/modules/taxonomy/src/TaxonomyPermissions.php, line 54
Contains \Drupal\taxonomy\TaxonomyPermissions.

Class

TaxonomyPermissions
Provides dynamic permissions of the taxonomy module.

Namespace

Drupal\taxonomy

Code

public function permissions() {
  $permissions = [];
  foreach ($this->entityManager
    ->getStorage('taxonomy_vocabulary')
    ->loadMultiple() as $vocabulary) {
    $permissions += [
      'edit terms in ' . $vocabulary
        ->id() => [
        'title' => $this
          ->t('Edit terms in %vocabulary', [
          '%vocabulary' => $vocabulary
            ->label(),
        ]),
      ],
    ];
    $permissions += [
      'delete terms in ' . $vocabulary
        ->id() => [
        'title' => $this
          ->t('Delete terms from %vocabulary', [
          '%vocabulary' => $vocabulary
            ->label(),
        ]),
      ],
    ];
  }
  return $permissions;
}