You are here

public function QuickNodeClonePermissions::cloneTypePermissions in Quick Node Clone 8

Returns an array of permissions.

Return value

array The permissions.

See also

\Drupal\user\PermissionHandlerInterface::getPermissions()

1 string reference to 'QuickNodeClonePermissions::cloneTypePermissions'
quick_node_clone.permissions.yml in ./quick_node_clone.permissions.yml
quick_node_clone.permissions.yml

File

src/QuickNodeClonePermissions.php, line 23

Class

QuickNodeClonePermissions
Module permissions.

Namespace

Drupal\quick_node_clone

Code

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

  // Generate node permissions for all node types.
  foreach (NodeType::loadMultiple() as $type) {
    $type_id = $type
      ->id();
    $type_params = [
      '%type' => $type
        ->label(),
    ];
    $perms += [
      "clone {$type_id} content" => [
        'title' => $this
          ->t('%type: clone content', $type_params),
      ],
    ];
  }
  return $perms;
}