You are here

function _workflow_rules_node_check_transition in Workflow 7.2

Condition implementation: check state transition..

Only for Workflow Node! Workflow Field can use default Rules condition.

Parameters

object $node: The node with the new values. Other entity types are not supported.

array $old_sids: An array of old sids to meet the condition.

array $new_sids: An array of new sids to meet the condition.

array $condition: A RulesCondition->settings array.

Return value

bool

1 string reference to '_workflow_rules_node_check_transition'
_workflownode_rules_condition_info in workflow_rules/workflow_rules.node.inc
Implements subfunction of hook_rules_condition_info().

File

workflow_rules/workflow_rules.rules-callback.inc, line 72
Callback implementations for Rules integration for the Workflow module.

Code

function _workflow_rules_node_check_transition($node, array $old_sids, array $new_sids, array $condition) {
  if (!($last_transition = workflow_transition_load_single('node', $node->nid, ''))) {
    return FALSE;
  }
  $old_sid = $last_transition->old_sid;
  $new_sid = $last_transition->new_sid;
  return _workflow_rules_workflow_check_given_state($old_sid, $old_sids) && _workflow_rules_workflow_check_given_state($new_sid, $new_sids);
}