You are here

public function ThunderTaxonomyPermissions::permissions in Thunder 8.5

Same name and namespace in other branches
  1. 8.2 modules/thunder_taxonomy/src/ThunderTaxonomyPermissions.php \Drupal\thunder_taxonomy\ThunderTaxonomyPermissions::permissions()
  2. 8.3 modules/thunder_taxonomy/src/ThunderTaxonomyPermissions.php \Drupal\thunder_taxonomy\ThunderTaxonomyPermissions::permissions()
  3. 8.4 modules/thunder_taxonomy/src/ThunderTaxonomyPermissions.php \Drupal\thunder_taxonomy\ThunderTaxonomyPermissions::permissions()
  4. 6.2.x modules/thunder_taxonomy/src/ThunderTaxonomyPermissions.php \Drupal\thunder_taxonomy\ThunderTaxonomyPermissions::permissions()
  5. 6.0.x modules/thunder_taxonomy/src/ThunderTaxonomyPermissions.php \Drupal\thunder_taxonomy\ThunderTaxonomyPermissions::permissions()
  6. 6.1.x modules/thunder_taxonomy/src/ThunderTaxonomyPermissions.php \Drupal\thunder_taxonomy\ThunderTaxonomyPermissions::permissions()

Get taxonomy permissions.

Return value

array Permissions array.

1 string reference to 'ThunderTaxonomyPermissions::permissions'
thunder_taxonomy.permissions.yml in modules/thunder_taxonomy/thunder_taxonomy.permissions.yml
modules/thunder_taxonomy/thunder_taxonomy.permissions.yml

File

modules/thunder_taxonomy/src/ThunderTaxonomyPermissions.php, line 49

Class

ThunderTaxonomyPermissions
Provides dynamic permissions of the taxonomy module.

Namespace

Drupal\thunder_taxonomy

Code

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