You are here

public function TaxonomyAccessFixPermissions::getPermissions in Taxonomy access fix 8.3

Same name and namespace in other branches
  1. 8.2 src/TaxonomyAccessFixPermissions.php \Drupal\taxonomy_access_fix\TaxonomyAccessFixPermissions::getPermissions()

Gets additional permissions for Taxonomy Vocabulary entities.

Return value

array Permissions array.

1 string reference to 'TaxonomyAccessFixPermissions::getPermissions'
taxonomy_access_fix.permissions.yml in ./taxonomy_access_fix.permissions.yml
taxonomy_access_fix.permissions.yml

File

src/TaxonomyAccessFixPermissions.php, line 47

Class

TaxonomyAccessFixPermissions
Provides additional permissions for entities provided by Taxonomy module.

Namespace

Drupal\taxonomy_access_fix

Code

public function getPermissions() {
  $permissions = [];
  $vocabularies = $this->entityTypeManager
    ->getStorage('taxonomy_vocabulary')
    ->loadMultiple();
  foreach ($vocabularies as $vocabulary) {
    $permissions['view terms in ' . $vocabulary
      ->id()] = [
      'title' => $this
        ->t('View terms in %vocabulary', [
        '%vocabulary' => $vocabulary
          ->label(),
      ]),
    ];
    $permissions['reorder terms in ' . $vocabulary
      ->id()] = [
      'title' => $this
        ->t('Reorder terms in %vocabulary', [
        '%vocabulary' => $vocabulary
          ->label(),
      ]),
    ];
  }
  return $permissions;
}