function TaxonomyPermissions::buildPermissions

Same name in other branches
  1. 9 core/modules/taxonomy/src/TaxonomyPermissions.php \Drupal\taxonomy\TaxonomyPermissions::buildPermissions()
  2. 10 core/modules/taxonomy/src/TaxonomyPermissions.php \Drupal\taxonomy\TaxonomyPermissions::buildPermissions()
  3. 11.x core/modules/taxonomy/src/TaxonomyPermissions.php \Drupal\taxonomy\TaxonomyPermissions::buildPermissions()

Builds a standard list of taxonomy term permissions for a given vocabulary.

Parameters

\Drupal\taxonomy\VocabularyInterface $vocabulary: The vocabulary.

Return value

array An array of permission names and descriptions.

1 call to TaxonomyPermissions::buildPermissions()
TaxonomyPermissions::permissions in core/modules/taxonomy/src/TaxonomyPermissions.php
Get taxonomy permissions.

File

core/modules/taxonomy/src/TaxonomyPermissions.php, line 74

Class

TaxonomyPermissions
Provides dynamic permissions of the taxonomy module.

Namespace

Drupal\taxonomy

Code

protected function buildPermissions(VocabularyInterface $vocabulary) {
    $id = $vocabulary->id();
    $args = [
        '%vocabulary' => $vocabulary->label(),
    ];
    return [
        "create terms in {$id}" => [
            'title' => $this->t('%vocabulary: Create terms', $args),
        ],
        "delete terms in {$id}" => [
            'title' => $this->t('%vocabulary: Delete terms', $args),
        ],
        "edit terms in {$id}" => [
            'title' => $this->t('%vocabulary: Edit terms', $args),
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.