You are here

function nodehierarchy_callback in Node Hierarchy 6

Same name and namespace in other branches
  1. 5 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 620

Code

function nodehierarchy_callback($child, $action) {
  if (empty($_GET['token']) || !drupal_valid_token($_GET['token'], 'nodehierarchy_action:' . $child->nid)) {
    return drupal_access_denied();
  }

  // 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();
}