You are here

protected function ViewUnpublishedPermissions::buildPermissions in view_unpublished 8

Returns a list of view unpublished 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.

1 call to ViewUnpublishedPermissions::buildPermissions()
ViewUnpublishedPermissions::permissions in src/ViewUnpublishedPermissions.php
Returns an array of view unpublished permissions per node type.

File

src/ViewUnpublishedPermissions.php, line 42

Class

ViewUnpublishedPermissions
Provides dynamic permissions for viewing unpublished nodes per type.

Namespace

Drupal\view_unpublished

Code

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