function EntityTestPermissions::buildPermissions

Same name and namespace in other branches
  1. 9 core/modules/system/tests/modules/entity_test/src/EntityTestPermissions.php \Drupal\entity_test\EntityTestPermissions::buildPermissions()
  2. 8.9.x core/modules/system/tests/modules/entity_test/src/EntityTestPermissions.php \Drupal\entity_test\EntityTestPermissions::buildPermissions()
  3. 10 core/modules/system/tests/modules/entity_test/src/EntityTestPermissions.php \Drupal\entity_test\EntityTestPermissions::buildPermissions()

Returns a list of entity test permissions for a given entity test bundle.

Parameters

\Drupal\entity_test\Entity\EntityTestBundle $type: The entity test bundle.

Return value

array An associative array of permission names and descriptions.

1 call to EntityTestPermissions::buildPermissions()
EntityTestPermissions::entityTestBundlePermissions in core/modules/system/tests/modules/entity_test/src/EntityTestPermissions.php
Returns an array of entity_test_bundle permissions.

File

core/modules/system/tests/modules/entity_test/src/EntityTestPermissions.php, line 41

Class

EntityTestPermissions
Provides dynamic permissions for entity test.

Namespace

Drupal\entity_test

Code

protected function buildPermissions(EntityTestBundle $type) {
    $type_id = $type->id();
    $type_params = [
        '%type_name' => $type->label(),
    ];
    return [
        "create {$type_id} entity_test_with_bundle entities" => [
            'title' => $this->t('%type_name: Create new entity', $type_params),
        ],
    ];
}

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