You are here

function state_flow_load_state_machine in State Machine 7.2

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

Load the state_flow state_machine for the given node.

Parameters

$node StdClass:

$reset Boolean:

Return value

StateFlow

19 calls to state_flow_load_state_machine()
drush_state_flow_schedule_process_items in modules/state_flow_schedule/state_flow_schedule.drush.inc
Publish scheduled nodes via drush
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.

... See full list

File

modules/state_flow/state_flow.module, line 411
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 = 'state_flow';

    //allow other modules to invoke other machine types
    drupal_alter('state_flow_machine_type', $machine_type, $node);
    $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];
}