Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. TaxonomyPermissions.php

function 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.

File

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

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),
        ],
        "view term revisions in {$id}" => [
            'title' => $this->t('%vocabulary: View term revisions', $args),
        ],
        "revert term revisions in {$id}" => [
            'title' => $this->t('%vocabulary: Revert term revisions', $args),
            'description' => $this->t('To revert a revision you also need permission to edit the taxonomy term.'),
        ],
        "delete term revisions in {$id}" => [
            'title' => $this->t('%vocabulary: Delete term revisions', $args),
            'description' => $this->t('To delete a revision you also need permission to delete the taxonomy term.'),
        ],
    ];
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal