You are here

function nodehierarchy_callback in Node Hierarchy 5

Same name and namespace in other branches
  1. 6 nodehierarchy.module \nodehierarchy_callback()

Callback to perform actions such as move up and down.

1 string reference to 'nodehierarchy_callback'
nodehierarchy_menu in ./nodehierarchy.module
Implementation of hook_menu().

File

./nodehierarchy.module, line 577
A module to make nodes hierarchical.

Code

function nodehierarchy_callback($nid, $action) {
  $child = node_load(array(
    'nid' => $nid,
  ));

  // Look to see if we need to change node order in this list
  if ($child && $action) {
    if ($action == 'up' && user_access('reorder children')) {
      nodehierarchy_movechild($child, 'up');
      drupal_set_message(t('<b>%s</b> has been moved <b>up</b>.', array(
        '%s' => $child->title,
      )));
    }
    elseif ($action == 'down' && user_access('reorder children')) {
      nodehierarchy_movechild($child, 'down');
      drupal_set_message(t('<b>%s</b> has been moved <b>down</b>.', array(
        '%s' => $child->title,
      )));
    }
  }
  drupal_goto();
}