You are here

protected function Permissions::buildPermissions in Block Content Permissions 8

Returns a list of block content permissions for a given type.

Parameters

\Drupal\block_content\BlockContentTypeInterface $type: The block content type.

Return value

array Array of permissions.

1 call to Permissions::buildPermissions()
Permissions::get in src/Permissions.php
Gets permissions.

File

src/Permissions.php, line 42

Class

Permissions
Provides dynamic permissions for the block content permissions module.

Namespace

Drupal\block_content_permissions

Code

protected function buildPermissions(BlockContentTypeInterface $type) {
  $type_id = $type
    ->id();
  $type_name = [
    '%type_name' => $type
      ->label(),
  ];
  return [
    "create {$type_id} block content" => [
      'title' => $this
        ->t('%type_name: Create new block content', $type_name),
    ],
    "delete any {$type_id} block content" => [
      'title' => $this
        ->t('%type_name: Delete any block content', $type_name),
    ],
    "update any {$type_id} block content" => [
      'title' => $this
        ->t('%type_name: Edit any block content', $type_name),
    ],
  ];
}