protected function Permissions::buildPermissions in Block Access 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 An associative array of permission names and descriptions.
1 call to Permissions::buildPermissions()
- Permissions::get in src/Permissions.php 
- Gets permissions.
File
- src/Permissions.php, line 41 
Class
- Permissions
- Defines a class for generating block content permissions per type.
Namespace
Drupal\block_accessCode
protected function buildPermissions(BlockContentTypeInterface $type) {
  $type_id = $type
    ->id();
  $type_params = [
    '%type_name' => $type
      ->label(),
  ];
  return [
    "create {$type_id} block_content" => [
      'title' => $this
        ->t('%type_name: Create new block content', $type_params),
    ],
    "update own {$type_id} block_content" => [
      'title' => $this
        ->t('%type_name: Edit own block content', $type_params),
    ],
    "update any {$type_id} block_content" => [
      'title' => $this
        ->t('%type_name: Edit any block content', $type_params),
    ],
    "delete own {$type_id} block_content" => [
      'title' => $this
        ->t('%type_name: Delete own block content', $type_params),
    ],
    "delete any {$type_id} block_content" => [
      'title' => $this
        ->t('%type_name: Delete any block content', $type_params),
    ],
  ];
}