protected function NotePermissions::buildPermissions in Drupal PM (Project Management) 4.x
Returns a list of node permissions for a given node type.
Parameters
\Drupal\pm_note\Entity\Note $type: The Note type.
Return value
array An associative array of permission names and descriptions.
1 call to NotePermissions::buildPermissions()
- NotePermissions::generatePermissions in modules/
pm_note/ src/ NotePermissions.php - Returns an array of node type permissions.
File
- modules/
pm_note/ src/ NotePermissions.php, line 43
Class
- NotePermissions
- Provides dynamic permissions for Note of different types.
Namespace
Drupal\pm_noteCode
protected function buildPermissions(Note $type) {
$type_id = 'pm_note ' . $type
->id();
$type_params = [
'%type_name' => $type
->label(),
];
return [
"{$type_id} create entities" => [
'title' => $this
->t('Create new %type_name entities', $type_params),
],
"{$type_id} edit own entities" => [
'title' => $this
->t('Edit own %type_name entities', $type_params),
],
"{$type_id} edit any entities" => [
'title' => $this
->t('Edit any %type_name entities', $type_params),
],
"{$type_id} delete own entities" => [
'title' => $this
->t('Delete own %type_name entities', $type_params),
],
"{$type_id} delete any entities" => [
'title' => $this
->t('Delete any %type_name entities', $type_params),
],
];
}