You are here

function _workflow_rules_node_check_state in Workflow 7.2

Condition implementation: check current state for Workflow Node API.

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 $sids: An array of State IDs to meet the condition.

Return value

bool

1 string reference to '_workflow_rules_node_check_state'
_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 97
Callback implementations for Rules integration for the Workflow module.

Code

function _workflow_rules_node_check_state($node, array $sids) {

  // Provide a fast exit if this is a node type without Workflow.
  // workflow_node_current_state() will return CreationState otherwise.
  if (!isset($node->workflow)) {
    return FALSE;
  }
  $field_name = '';

  // An explicit var is needed.
  $sid = workflow_node_current_state($node, 'node', $field_name);
  return _workflow_rules_workflow_check_given_state($sid, $sids);
}