You are here

function state_flow_node_page_edit in State Machine 6

Helper function to to load the lastest revision on node edit

Parameters

object $node:

1 string reference to 'state_flow_node_page_edit'
state_flow_menu_alter in modules/state_flow/state_flow.module
Implementation of hook_menu_alter Change the edit link so the most recent revision is always edited

File

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

Code

function state_flow_node_page_edit($node) {
  $state_flow = state_flow_load_state_machine($node);
  $vid = $state_flow
    ->get_latest_revision($node->nid);

  //Load the latest revision if it doesn't match what is part of the node
  if ($node->vid != $vid) {
    $node = node_load($node->nid, $vid);
  }
  return node_page_edit($node);
}