public function NodeViewPermissionsPermissions::permissions in Node View Permissions 8
Permission function.
Added the permissions.
1 string reference to 'NodeViewPermissionsPermissions::permissions'
File
- src/
NodeViewPermissionsPermissions.php, line 23
Class
- NodeViewPermissionsPermissions
- Class definition.
Namespace
Drupal\node_view_permissionsCode
public function permissions() {
$permissions = [];
$nodeTypes = NodeType::loadMultiple();
foreach ($nodeTypes as $nodeType) {
/** @var \Drupal\node\Entity\NodeType $nodeType */
$permission = 'view any ' . $nodeType
->id() . ' content';
$permissions[$permission] = [
'title' => $this
->t('<em>@type_label</em>: View any content', [
'@type_label' => $nodeType
->label(),
]),
];
$permission = 'view own ' . $nodeType
->id() . ' content';
$permissions[$permission] = [
'title' => $this
->t('<em>@type_label</em>: View own content', [
'@type_label' => $nodeType
->label(),
]),
];
}
return $permissions;
}