You are here

function state_flow_operation_change_helper in State Machine 7.3

Same name and namespace in other branches
  1. 7.2 modules/state_flow/state_flow.module \state_flow_operation_change_helper()
2 calls to state_flow_operation_change_helper()
state_flow_node_revision_operation_change_state in modules/state_flow/state_flow.module
Operation callback to change state of a node
state_flow_node_revision_operation_change_state_batch_process in modules/state_flow/state_flow.module
State Change Mass Update Batch operation

File

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

Code

function state_flow_operation_change_helper($info, $event) {
  global $user;
  $node = node_load($info['nid'], $info['vid']);
  $machine = state_flow_entity_load_state_machine($node, 'node');
  $allowed_events = $machine
    ->get_available_events();
  if (in_array($event, $allowed_events)) {
    $machine
      ->fire_event($event, $user->uid, 'State changed via Bulk Node Operation');
    return t('@title has been transitioned to @state', array(
      '@title' => $node->title,
      '@state' => $state_machine
        ->get_label_for_current_state(),
    ));
  }
}