public function ChecklistapiPermissions::perChecklistPermissions in Checklist API 8
Returns an array of per checklist permissions.
Return value
array An array of permission details.
1 string reference to 'ChecklistapiPermissions::perChecklistPermissions'
File
- src/
ChecklistapiPermissions.php, line 45
Class
- ChecklistapiPermissions
- Defines a class containing permission callbacks.
Namespace
Drupal\checklistapiCode
public function perChecklistPermissions() {
$perms = [];
// Per checklist permissions.
foreach (checklistapi_get_checklist_info() as $id => $definition) {
$checklist = checklistapi_checklist_load($id);
if (!$checklist) {
continue;
}
$title = $checklist->title;
$perms["view {$id} checklistapi checklist"] = [
'title' => t('View the @name checklist', [
'@name' => $title,
]),
'description' => $this->viewPermissionDescription,
];
$perms["edit {$id} checklistapi checklist"] = [
'title' => t('Edit the @name checklist', [
'@name' => $title,
]),
'description' => $this->editPermissionDescription,
];
}
return $perms;
}