public function Update120::grantUnpublishedContentReviewerAccess in Lightning Workflow 8.3
Same name and namespace in other branches
- 8 src/Update/Update120.php \Drupal\lightning_workflow\Update\Update120::grantUnpublishedContentReviewerAccess()
- 8.2 src/Update/Update120.php \Drupal\lightning_workflow\Update\Update120::grantUnpublishedContentReviewerAccess()
Grants the reviewer content role permissions to view unpublished content.
@update
Parameters
\Symfony\Component\Console\Style\StyleInterface $io: The I/O style.
File
- src/
Update/ Update120.php, line 63
Class
- Update120
- Contains optional updates targeting Lightning Workflow 1.2.0.
Namespace
Drupal\lightning_workflow\UpdateCode
public function grantUnpublishedContentReviewerAccess(StyleInterface $io) {
if (!$this->moduleHandler
->moduleExists('lightning_roles')) {
return;
}
/** @var \Drupal\lightning_roles\ContentRoleManager $role_manager */
$role_manager = $this->container
->get('lightning.content_roles');
$question = (string) $this
->t('Do you want to give content reviewers the ability to view unpublished content?');
if ($io
->confirm($question)) {
$role_manager
->grantPermissions('reviewer', [
'view any unpublished content',
]);
}
$question = (string) $this
->t('Do you want to give content reviewers the ability to view the latest unpublished revisions of content?');
if ($io
->confirm($question)) {
$role_manager
->grantPermissions('reviewer', [
'view latest version',
]);
}
}