You are here

function state_flow_load_state_machine in State Machine 7

Same name and namespace in other branches
  1. 6 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.

11 calls to state_flow_load_state_machine()
StateFlow::set_published in modules/state_flow/plugins/state_flow.inc
StateFlowUnitTest::testStateFlowStateMachine in modules/state_flow/tests/state_flow.test
state_flow_access in modules/state_flow/state_flow.module
Determine whether a user has permission to transition a node with an event.
state_flow_entity_get_state in modules/state_flow/state_flow.module
Getter callback for the "state" property on node bundles using workflow.
state_flow_events in modules/state_flow/state_flow.pages.inc
Page callback for a node's Workflow page.

... See full list

File

modules/state_flow/state_flow.module, line 317
An implementation of node revision workflow for Drupal based on the State Machine system.

Code

function state_flow_load_state_machine($node, $reset = FALSE) {
  $objects =& drupal_static(__FUNCTION__);
  if (!isset($objects[$node->vid]) || $reset) {
    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');
      $state_flow_object = new $class($node);
      $objects[$node->vid] = $state_flow_object;
    }
  }
  return $objects[$node->vid];
}