You are here

function nodequeue_menu in Nodequeue 6.2

Same name and namespace in other branches
  1. 5.2 nodequeue.module \nodequeue_menu()
  2. 5 nodequeue.module \nodequeue_menu()
  3. 7.3 nodequeue.module \nodequeue_menu()
  4. 7.2 nodequeue.module \nodequeue_menu()

Implementation of hook_menu

File

./nodequeue.module, line 25
Maintains queues of nodes in arbitrary order.

Code

function nodequeue_menu() {
  $items = array();
  $admin_access = array(
    'administer nodequeue',
  );

  // administrative items
  $items['admin/content/nodequeue'] = array(
    'title' => 'Nodequeue',
    'page callback' => 'nodequeue_view_queues',
    'access callback' => '_nodequeue_access_admin_or_manipulate',
    'description' => 'Create and maintain simple nodequeues.',
    'file' => 'includes/nodequeue.admin.inc',
    'type' => MENU_NORMAL_ITEM,
  );
  $items['admin/content/nodequeue/list'] = array(
    'title' => 'List',
    'page callback' => 'nodequeue_view_queues',
    'access callback' => '_nodequeue_access_admin_or_manipulate',
    'file' => 'includes/nodequeue.admin.inc',
    'weight' => -1,
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items['admin/content/nodequeue/settings'] = array(
    'title' => 'Settings',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'nodequeue_admin_settings',
    ),
    'access arguments' => $admin_access,
    'file' => 'includes/nodequeue.admin.inc',
    'type' => MENU_LOCAL_TASK,
  );
  $items['nodequeue/autocomplete'] = array(
    'title' => 'Autocomplete',
    'page callback' => 'nodequeue_autocomplete',
    'access callback' => '_nodequeue_access_admin_or_manipulate',
    'file' => 'includes/nodequeue.admin.inc',
    'type' => MENU_CALLBACK,
  );
  $info = nodequeue_api_info();
  foreach ($info as $key => $data) {
    $items['admin/content/nodequeue/add/' . $key] = array(
      'title' => 'Add @type',
      'title arguments' => array(
        '@type' => strtolower($data['title']),
      ),
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'nodequeue_edit_queue_form',
        $key,
      ),
      'access arguments' => $admin_access,
      'file' => 'includes/nodequeue.admin.inc',
      'type' => MENU_LOCAL_TASK,
    );
  }
  $items['node/%node/nodequeue'] = array(
    'title' => '@tab',
    'title arguments' => array(
      '@tab' => variable_get('nodequeue_tab_name', 'Nodequeue'),
    ),
    'page callback' => 'nodequeue_node_tab',
    'page arguments' => array(
      1,
    ),
    'access callback' => 'nodequeue_node_tab_access',
    'access arguments' => array(
      1,
    ),
    'file' => 'includes/nodequeue.admin.inc',
    'weight' => 5,
    'type' => MENU_LOCAL_TASK,
  );

  // Administrative items for an individual queue.
  $items['admin/content/nodequeue/%nodequeue'] = array(
    'page callback' => 'nodequeue_admin_view',
    'page arguments' => array(
      3,
    ),
    'access callback' => 'nodequeue_queue_access',
    'access arguments' => array(
      3,
    ),
    'file' => 'includes/nodequeue.admin.inc',
    'type' => MENU_CALLBACK,
  );
  $items['admin/content/nodequeue/%nodequeue/view'] = array(
    'title' => 'View',
    'page callback' => 'nodequeue_admin_view',
    'page arguments' => array(
      3,
    ),
    'access callback' => 'nodequeue_queue_access',
    'access arguments' => array(
      3,
    ),
    'file' => 'includes/nodequeue.admin.inc',
    'weight' => -10,
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items['admin/content/nodequeue/%nodequeue/view/%subqueue'] = array(
    'title' => 'View',
    'page callback' => 'nodequeue_admin_view',
    'page arguments' => array(
      3,
      5,
    ),
    'access callback' => 'nodequeue_queue_access',
    'access arguments' => array(
      3,
      5,
    ),
    'file' => 'includes/nodequeue.admin.inc',
    'weight' => -10,
    'tab parent' => 'admin/content/nodequeue/%',
    'type' => MENU_LOCAL_TASK,
  );

  // Actual administrative items.
  $items['admin/content/nodequeue/%nodequeue/edit'] = array(
    'title' => 'Edit queue',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'nodequeue_edit_queue_form',
      3,
    ),
    'access arguments' => $admin_access,
    'file' => 'includes/nodequeue.admin.inc',
    'type' => MENU_LOCAL_TASK,
  );
  $items['admin/content/nodequeue/%nodequeue/delete'] = array(
    'title' => 'Delete',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'nodequeue_admin_delete',
      3,
    ),
    'access arguments' => $admin_access,
    'file' => 'includes/nodequeue.admin.inc',
    'weight' => 5,
    'type' => MENU_CALLBACK,
  );
  $items["admin/content/nodequeue/%nodequeue/add/%subqueue/%node"] = array(
    'page callback' => 'nodequeue_admin_add_node',
    'page arguments' => array(
      3,
      5,
      6,
    ),
    'access callback' => 'nodequeue_node_and_queue_access',
    'access arguments' => array(
      6,
      3,
      5,
    ),
    'file' => 'includes/nodequeue.admin.inc',
    'type' => MENU_CALLBACK,
  );
  $items["admin/content/nodequeue/%nodequeue/remove-node/%subqueue/%node"] = array(
    'page callback' => 'nodequeue_admin_remove_node',
    'page arguments' => array(
      3,
      5,
      6,
    ),
    'access callback' => 'nodequeue_node_and_queue_access',
    'access arguments' => array(
      6,
      3,
      5,
    ),
    'file' => 'includes/nodequeue.admin.inc',
    'type' => MENU_CALLBACK,
  );
  $items["admin/content/nodequeue/%nodequeue/clear/%subqueue"] = array(
    'title' => 'Clear',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'nodequeue_clear_confirm',
      3,
      5,
    ),
    'access callback' => 'nodequeue_queue_access',
    'access arguments' => array(
      3,
      5,
    ),
    'file' => 'includes/nodequeue.admin.inc',
    'type' => MENU_CALLBACK,
  );
  return $items;
}