public function TaxonomyPermissions::permissions in Taxonomy Permissions 8
Returns an array of transition permissions.
Return value
array The access protected permissions.
1 string reference to 'TaxonomyPermissions::permissions'
File
- src/
TaxonomyPermissions.php, line 48
Class
- TaxonomyPermissions
- Defines a class for dynamic permissions based on vocabularies.
Namespace
Drupal\taxonomy_permissionsCode
public function permissions() {
$perms = [];
$vocabularies = Vocabulary::loadMultiple();
/* @var \Drupal\taxonomy\Entity\Vocabulary $vocabulary */
foreach ($vocabularies as $id => $vocabulary) {
$perms['view terms in ' . $id] = [
'title' => $this
->t('View terms in %label', [
'%label' => $vocabulary
->label(),
]),
'description' => $this
->t('View the terms of %label vocabulary', [
'%label' => $vocabulary
->label(),
]),
];
}
return $perms;
}