You are here

protected function UnpublishedNodePermissions::buildPermissions in Unpublished Node Permissions 8

Returns a list of node permissions for a given node type.

Parameters

\Drupal\node\Entity\NodeType $type: The node type.

Return value

array An associative array of permission names and descriptions.

Overrides NodePermissions::buildPermissions

File

src/UnpublishedNodePermissions.php, line 22

Class

UnpublishedNodePermissions
Provides dynamic permissions for nodes of different types.

Namespace

Drupal\unpublished_node_permissions

Code

protected function buildPermissions(NodeType $type) {
  $type_id = $type
    ->id();
  $type_params = [
    '%type_name' => $type
      ->label(),
  ];
  return [
    "view {$type_id} unpublished content" => [
      'title' => $this
        ->t('%type_name: View unpublished content', $type_params),
    ],
  ];
}