You are here

function workflow_transition_allowed in Workflow 7.2

Same name and namespace in other branches
  1. 5.2 workflow.module \workflow_transition_allowed()
  2. 5 workflow.module \workflow_transition_allowed()
  3. 6.2 workflow.module \workflow_transition_allowed()
  4. 6 workflow.module \workflow_transition_allowed()
  5. 7 workflow.module \workflow_transition_allowed()

See if a transition is allowed for a given role.

@deprecated: workflow_transition_allowed => WorkflowConfigTransition::isAllowed

Parameters

int $tid: A transition ID.

mixed $role: A single role (int or string 'author') or array of roles.

Return value

bool TRUE if the role is allowed to do the transition.

File

./workflow.deprecated.inc, line 623
Contains contains per-class functions, that are deprecated.

Code

function workflow_transition_allowed($tid, $role = NULL) {
  $config_transitions = entity_load('WorkflowConfigTransition', array(
    $tid,
  ));
  $config_transition = reset($config_transitions);
  if ($role) {
    if (!is_array($role)) {
      $role = array(
        $role,
      );
    }
    $allowed = $config_transition->roles;
    return array_intersect($role, $allowed) == TRUE;
  }
}