Beispiel #1
0
 public function setWorkflow(Workflow $workflow)
 {
     workflow_debug(__FILE__, __FUNCTION__, __LINE__);
     // @todo D8-port: still test this snippet.
     $this->wid = $workflow->id();
     $this->workflow = $workflow;
 }
 /**
  * Returns a list of workflow permissions for a given workflow type.
  *
  * @param \Drupal\workflow\Entity\WorkflowType $type
  *   The workflow type.
  *
  * @return array
  *   An associative array of permission names and descriptions.
  */
 protected function buildPermissions(\Drupal\workflow\Entity\Workflow $type)
 {
     $type_id = $type->id();
     $type_params = array('%type_name' => $type->label());
     return array("edit own {$type_id} workflow_transition" => array('title' => $this->t('%type_name: Edit own comments', $type_params), 'description' => t('Edit the comment of own executed state transitions.'), 'restrict access' => TRUE), "edit any {$type_id} workflow_transition" => array('title' => $this->t('%type_name: Edit any comments', $type_params), 'description' => t('Edit the comment of any executed state transitions.'), 'restrict access' => TRUE), "revert own {$type_id} workflow_transition" => array('title' => $this->t('%type_name: Revert own state transition', $type_params), 'description' => t('Allow user to revert own last executed state transition on entity.'), 'restrict access' => TRUE), "revert any {$type_id} workflow_transition" => array('title' => $this->t('%type_name: Revert any state transition', $type_params), 'description' => t('Allow user to revert any last executed state transition on entity.'), 'restrict access' => TRUE));
 }
 /**
  * {@inheritdoc}
  */
 public static function participateUserRoles(Workflow $workflow)
 {
     $type_id = $workflow->id();
     foreach (user_roles() as $rid => $role) {
         $perms = array("create {$type_id} workflow_transition" => 1);
         user_role_change_permissions($rid, $perms);
         // <=== Enable Roles.
     }
 }
 /**
  * Returns a list of workflow permissions for a given workflow type.
  *
  * @param \Drupal\workflow\Entity\WorkflowType $type
  *   The workflow type.
  *
  * @return array
  *   An associative array of permission names and descriptions.
  */
 protected function buildPermissions(Workflow $type)
 {
     $type_id = $type->id();
     $type_params = array('%type_name' => $type->label());
     return array("bypass {$type_id} workflow_transition access" => array('title' => $this->t('%type_name: Bypass transition access control', $type_params), 'description' => t('View, edit and delete all transitions regardless of permission restrictions.'), 'restrict access' => TRUE), "create {$type_id} workflow_transition" => array('title' => $this->t('%type_name: Participate in workflow', $type_params), 'description' => t('Role is enabled to create state transitions. (Determine transition-specific permission on the workflow admin page.)')), "schedule {$type_id} workflow_transition" => array('title' => $this->t('%type_name: Schedule state transition', $type_params), 'description' => t('Role is enabled to schedule state transitions.')), "access own {$type_id} workflow_transion overview" => array('title' => $this->t('%type_name: Access Workflow history tab of own content', $type_params), 'description' => t('Role is enabled to view the "Workflow state transition history" tab on own entity.')), "access any {$type_id} workflow_transion overview" => array('title' => $this->t('%type_name: Access Workflow history tab of any content', $type_params), 'description' => t('Role is enabled to view the "Workflow state transition history" tab on any entity.')), "access {$type_id} workflow_transition form" => array('title' => $this->t('%type_name: Access the Workflow state transition form on entity view page', $type_params), 'description' => t('Role is enabled to view a "Workflow state transition" block/widget and add a state transition on the entity page.')));
 }