You are here

private function DomainAccessPermissions::nodePermissions in Domain Access 8

Helper method to generate standard node permission list for a given type.

Shamelessly lifted from node_list_permissions().

Parameters

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

Return value

array An array of permission names and descriptions.

1 call to DomainAccessPermissions::nodePermissions()
DomainAccessPermissions::permissions in domain_access/src/DomainAccessPermissions.php
Define permissions.

File

domain_access/src/DomainAccessPermissions.php, line 68

Class

DomainAccessPermissions
Dynamic permissions class for Domain Access.

Namespace

Drupal\domain_access

Code

private function nodePermissions(NodeType $type) {

  // Build standard list of node permissions for this type.
  $id = $type
    ->id();
  $perms = [
    "create {$id} content on assigned domains" => [
      'title' => $this
        ->t('%type_name: Create new content on assigned domains', [
        '%type_name' => $type
          ->label(),
      ]),
    ],
    "update {$id} content on assigned domains" => [
      'title' => $this
        ->t('%type_name: Edit any content on assigned domains', [
        '%type_name' => $type
          ->label(),
      ]),
    ],
    "delete {$id} content on assigned domains" => [
      'title' => $this
        ->t('%type_name: Delete any content on assigned domains', [
        '%type_name' => $type
          ->label(),
      ]),
    ],
  ];
  return $perms;
}