public function Permissions::transitionPermissions in Drupal 8
Same name and namespace in other branches
- 9 core/modules/content_moderation/src/Permissions.php \Drupal\content_moderation\Permissions::transitionPermissions()
Returns an array of transition permissions.
Return value
array The transition permissions.
1 string reference to 'Permissions::transitionPermissions'
- content_moderation.permissions.yml in core/
modules/ content_moderation/ content_moderation.permissions.yml - core/modules/content_moderation/content_moderation.permissions.yml
File
- core/
modules/ content_moderation/ src/ Permissions.php, line 23
Class
- Permissions
- Defines a class for dynamic permissions based on transitions.
Namespace
Drupal\content_moderationCode
public function transitionPermissions() {
$permissions = [];
/** @var \Drupal\workflows\WorkflowInterface $workflow */
foreach (Workflow::loadMultipleByType('content_moderation') as $id => $workflow) {
foreach ($workflow
->getTypePlugin()
->getTransitions() as $transition) {
$permissions['use ' . $workflow
->id() . ' transition ' . $transition
->id()] = [
'title' => $this
->t('%workflow workflow: Use %transition transition.', [
'%workflow' => $workflow
->label(),
'%transition' => $transition
->label(),
]),
];
}
}
return $permissions;
}