function workflownode_node_load in Workflow 7.2
Implements hook_node_load().
File
- workflow_node/workflownode.module, line 42 
- Hooks and functions for the 'conventional' (version D5/D6/D7.1) Workflow Node, remnants of nodeapi.
Code
function workflownode_node_load($nodes, $types) {
  // Get which types have workflows associated with them.
  $workflow_types = workflow_get_workflow_type_map();
  // Leave early if nodes do not have workflow.
  if (!$workflow_types || !array_intersect_key($workflow_types, array_flip($types))) {
    return;
  }
  // Read the current state for all nodes.
  $states = workflow_get_workflow_node_by_nid(array_keys($nodes));
  foreach ($nodes as $nid => $node) {
    // If it's not a workflow type, quit immediately.
    if (!array_key_exists($node->type, $workflow_types)) {
      continue;
    }
    // Nodes that existed before the workflow was defined may not have a state.
    $workflow_node = isset($states[$nid]) ? $states[$nid] : NULL;
    if (!$workflow_node) {
      if ($workflow = workflow_get_workflows_by_type($node->type, 'node')) {
        $node->workflow = $workflow
          ->getCreationSid();
        $node->workflow_stamp = $node->created;
      }
      else {
        // Is this possible?
      }
    }
    else {
      $node->workflow = $workflow_node->sid;
      $node->workflow_stamp = $workflow_node->stamp;
    }
  }
  // As of workflow 7.x-2.x, the scheduled transition is not loaded. See issue #2138591.
}