public function PublishContentPermissions::permissions in Publish Content 8
Returns the list of permissions.
1 string reference to 'PublishContentPermissions::permissions'
File
- src/
PublishContentPermissions.php, line 45
Class
- PublishContentPermissions
- Handles permissions.
Namespace
Drupal\publishcontentCode
public function permissions() {
$permissions = [];
$nodeTypes = NodeType::loadMultiple();
foreach ($nodeTypes as $type => $data) {
$titleType = ucfirst($type);
$permissions[self::getPermission(self::PUBLISH_ANY_TYPE, [
'@type' => $type,
])] = [
'title' => $this
->t("@titleType: publish any node type", [
'@titleType' => $titleType,
]),
];
$permissions[self::getPermission(self::PUBLISH_OWN_TYPE, [
'@type' => $type,
])] = [
'title' => $this
->t("@titleType: publish own node type", [
'@titleType' => $titleType,
]),
];
$permissions[self::getPermission(self::PUBLISH_EDITABLE_TYPE, [
'@type' => $type,
])] = [
'title' => $this
->t("@titleType: publish editable node type", [
'@titleType' => $titleType,
]),
];
$permissions[self::getPermission(self::UNPUBLISH_ANY_TYPE, [
'@type' => $type,
])] = [
'title' => $this
->t("@titleType: unpublish any node type", [
'@titleType' => $titleType,
]),
];
$permissions[self::getPermission(self::UNPUBLISH_OWN_TYPE, [
'@type' => $type,
])] = [
'title' => $this
->t("@titleType: unpublish own node type", [
'@titleType' => $titleType,
]),
];
$permissions[self::getPermission(self::UNPUBLISH_EDITABLE_TYPE, [
'@type' => $type,
])] = [
'title' => $this
->t("@titleType: unpublish editable node type", [
'@titleType' => $titleType,
]),
];
}
return $permissions;
}