You are here

function workflownode_node_update in Workflow 7.2

Implements hook_node_update().

1 call to workflownode_node_update()
workflownode_node_insert in workflow_node/workflownode.module
Implements hook_node_insert().

File

workflow_node/workflownode.module, line 171
Hooks and functions for the 'conventional' (version D5/D6/D7.1) Workflow Node, remnants of nodeapi.

Code

function workflownode_node_update($node) {
  if (!isset($node->workflow_field)) {

    // For this type_map, user did not want a form here.
    return;
  }
  $form = array();

  // Retrieve the data from the form.
  // Add form values (field, instance, entity_type, entity), then form input.
  $form_state = array();
  $form_state['values']['workflow_field'] = $node->workflow_field;
  $form_state['values']['workflow_instance'] = $node->workflow_instance;
  $form_state['values']['workflow_entity_type'] = 'node';

  // Careful: take the fresh node here, not the one that is in the form.
  $form_state['values']['workflow_entity'] = $node;

  // For some reason, the Workflow Form does not return the form in a 'workflow' array.
  // @todo: correct this (use '#tree => TRUE'), or filter on 'workflow' elements.
  $form_state['input'] = (array) $node;
  workflow_transition_form_submit($form, $form_state);
}