QuickNodeClonePermissions.php in Quick Node Clone 8
File
src/QuickNodeClonePermissions.php
View source
<?php
namespace Drupal\quick_node_clone;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\node\Entity\NodeType;
class QuickNodeClonePermissions {
use StringTranslationTrait;
public function cloneTypePermissions() {
$perms = [];
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;
}
}