function BundlePermissionHandlerTraitTest::buildPermissions

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Entity/BundlePermissionHandlerTraitTest.php \Drupal\KernelTests\Core\Entity\BundlePermissionHandlerTraitTest::buildPermissions()
  2. 10 core/tests/Drupal/KernelTests/Core/Entity/BundlePermissionHandlerTraitTest.php \Drupal\KernelTests\Core\Entity\BundlePermissionHandlerTraitTest::buildPermissions()

File

core/tests/Drupal/KernelTests/Core/Entity/BundlePermissionHandlerTraitTest.php, line 69

Class

BundlePermissionHandlerTraitTest
@coversDefaultClass \Drupal\Core\Entity\BundlePermissionHandlerTrait

Namespace

Drupal\KernelTests\Core\Entity

Code

protected function buildPermissions(EntityInterface $bundle) : array {
    return [
        "create {$bundle->id()}" => [
            'title' => 'Create',
        ],
        "edit {$bundle->id()}" => [
            'title' => 'Edit',
            // Ensure it is possible for buildPermissions to add additional
            // dependencies.
'dependencies' => [
                'config' => [
                    "test_module.entity.{$bundle->id()}",
                ],
                'module' => [
                    'test_module',
                ],
            ],
        ],
    ];
}

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