You are here

function nodeorder_menu in Node Order 5

Same name and namespace in other branches
  1. 6 nodeorder.module \nodeorder_menu()
  2. 7 nodeorder.module \nodeorder_menu()

Implementation of hook_menu().

File

./nodeorder.module, line 429

Code

function nodeorder_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/settings/nodeorder',
      'title' => t('Nodeorder'),
      'description' => t('Allows the ordering of nodes within taxonomy terms.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => 'nodeorder_admin',
      'access' => user_access('access administration pages'),
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'nodeorder/term',
      'title' => t('nodeorder term'),
      'callback' => 'nodeorder_term_page',
      // I want to call taxonomy_term_page but can't change the sort order...
      'access' => user_access('access content'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'nodeorder/order',
      'title' => t('order'),
      'callback' => 'nodeorder_order_nodes',
      'access' => user_access('order nodes within categories'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'nodeorder/order',
      'title' => t('nodeorder order nodes'),
      'callback' => 'nodeorder_order_nodes',
      'access' => user_access('order nodes within categories'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'nodeorder/reordered',
      'title' => t('nodeorder reordered nodes'),
      'callback' => 'nodeorder_reordered',
      'access' => user_access('order nodes within categories'),
      'type' => MENU_CALLBACK,
    );
  }
  else {
    if (arg(0) == 'nodeorder' && (arg(1) == 'moveup' || arg(1) == 'movedown') && is_numeric(arg(2)) && is_numeric(arg(3))) {
      $node = node_load(arg(2));
      $items[] = array(
        'path' => 'nodeorder/moveup/' . $node->nid,
        'title' => t('Move Up'),
        'callback' => 'nodeorder_move_in_category',
        'callback arguments' => array(
          $node,
          arg(3),
          true,
        ),
        'access' => user_access('order nodes within categories'),
        'type' => MENU_CALLBACK,
      );
      $items[] = array(
        'path' => 'nodeorder/movedown/' . $node->nid,
        'title' => t('Move Down'),
        'callback' => 'nodeorder_move_in_category',
        'callback arguments' => array(
          $node,
          arg(3),
          false,
        ),
        'access' => user_access('order nodes within categories'),
        'type' => MENU_CALLBACK,
      );
    }
    else {
      if (is_numeric(arg(3))) {
        $vid = arg(3);
        $items[] = array(
          'path' => 'admin/content/taxonomy/' . $vid . '/order',
          'title' => t('order nodes'),
          'callback' => 'nodeorder_overview_terms',
          'callback arguments' => array(
            $vid,
          ),
          'access' => user_access('order nodes within categories') && nodeorder_vocabulary_can_be_ordered($vid),
          'weight' => 5,
          'type' => MENU_LOCAL_TASK,
        );
      }
    }
  }
  return $items;
}