public function TaxonomyAccessFixPermissions::getPermissions in Taxonomy access fix 8.2
Same name and namespace in other branches
- 8.3 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'
File
- src/
TaxonomyAccessFixPermissions.php, line 47
Class
- TaxonomyAccessFixPermissions
- Provides additional permissions for entities provided by Taxonomy module.
Namespace
Drupal\taxonomy_access_fixCode
public function getPermissions() {
$permissions = [];
$vocabularies = $this->entityTypeManager
->getStorage('taxonomy_vocabulary')
->loadMultiple();
$schema_version = 0;
if (count($vocabularies) > 0) {
$schema_version = (int) drupal_get_installed_schema_version('taxonomy_access_fix');
}
foreach ($vocabularies as $vocabulary) {
$permissions['view terms in ' . $vocabulary
->id()] = [
'title' => $this
->t('View terms in %vocabulary', [
'%vocabulary' => $vocabulary
->label(),
]),
];
// @todo: Remove in 8.x-3.x or later or mark as deprecated once Issue
// 2924785 has been fixed.
if ($schema_version < 8202) {
$permissions['add terms in ' . $vocabulary
->id()] = [
'title' => $this
->t('Add terms in %vocabulary', [
'%vocabulary' => $vocabulary
->label(),
]),
'description' => $this
->t("This permission is <strong>no longer used</strong> and will be removed in a future release. Use the @permission_label permission provided by Drupal Core's %module_label module instead.", [
'%module_label' => $this
->t('Taxonomy'),
'@permission_label' => $this
->t('"%vocabulary: Create terms"', [
'%vocabulary' => $vocabulary
->label(),
]),
]),
];
}
$permissions['reorder terms in ' . $vocabulary
->id()] = [
'title' => $this
->t('Reorder terms in %vocabulary', [
'%vocabulary' => $vocabulary
->label(),
]),
];
}
return $permissions;
}