You are here

public function ViewUnpublishedPermissions::permissions in view_unpublished 8

Returns an array of view unpublished permissions per node type.

Return value

array The node type view unpublished permissions.

See also

\Drupal\user\PermissionHandlerInterface::getPermissions()

1 string reference to 'ViewUnpublishedPermissions::permissions'
view_unpublished.permissions.yml in ./view_unpublished.permissions.yml
view_unpublished.permissions.yml

File

src/ViewUnpublishedPermissions.php, line 23

Class

ViewUnpublishedPermissions
Provides dynamic permissions for viewing unpublished nodes per type.

Namespace

Drupal\view_unpublished

Code

public function permissions() {
  $perms = [];

  // Generate view unpublished permissions for all node types.
  foreach (NodeType::loadMultiple() as $type) {
    $perms += $this
      ->buildPermissions($type);
  }
  return $perms;
}