You are here

public static function WorkflowManager::participateUserRoles in Workflow 8

Implements hook_WORKFLOW_insert().

Make sure some roles are allowed to participate in a Workflow by default.

Parameters

\Drupal\Core\Entity\EntityInterface $workflow:

Overrides WorkflowManagerInterface::participateUserRoles

1 call to WorkflowManager::participateUserRoles()
workflow_workflow_type_insert in ./workflow.module
Implements hook_ENTITY_TYPE_insert().

File

src/Entity/WorkflowManager.php, line 343

Class

WorkflowManager
Manages entity type plugin definitions.

Namespace

Drupal\workflow\Entity

Code

public static function participateUserRoles(EntityInterface $workflow) {
  $type_id = $workflow
    ->id();
  foreach (user_roles() as $rid => $role) {
    $perms = [
      "create {$type_id} workflow_transition" => 1,
    ];
    user_role_change_permissions($rid, $perms);

    // <=== Enable Roles.
  }
}