You are here

function state_flow_load_state_machine in State Machine 6

Same name and namespace in other branches
  1. 7 modules/state_flow/state_flow.module \state_flow_load_state_machine()
  2. 7.2 modules/state_flow/state_flow.module \state_flow_load_state_machine()

Load the state_flow state_machine for the given node.

6 calls to state_flow_load_state_machine()
StateFlowUnitTest::testStateFlowStateMachine in modules/state_flow/tests/state_flow.test
state_flow_events in modules/state_flow/state_flow.module
Show the states as a node tab
state_flow_node_insert in modules/state_flow/state_flow.module
Implementation of hook_node_insert().
state_flow_node_page_edit in modules/state_flow/state_flow.module
Helper function to to load the lastest revision on node edit
state_flow_node_presave in modules/state_flow/state_flow.module
Implementation of hook_node_presave()

... See full list

File

modules/state_flow/state_flow.module, line 156
A base implementation of the state machine class and its relationship to revisions

Code

function state_flow_load_state_machine($node) {
  static $object = array();
  if (!isset($object[$node->vid])) {
    ctools_include('plugins');
    $machine_type = variable_get('state_flow_' . $node->type, 'state_flow');
    $plugin = ctools_get_plugins('state_flow', 'plugins', $machine_type);
    if (!empty($plugin)) {
      $class = ctools_plugin_get_class($plugin, 'handler');
      $object[$node->vid] = new $class($node);
    }
  }
  return $object[$node->vid];
}