You are here

function weight_menu in Weight 5

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

Implementation of hook_menu().

File

./weight.module, line 58

Code

function weight_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $access = user_access('administer site configuration');

    // ajax callback for weight changer page
    $items[] = array(
      'path' => 'admin/node/weight/_change_weight',
      'callback' => '_change_weight',
      'access' => user_access('administer nodes'),
      'type' => MENU_CALLBACK,
    );

    // top level settings
    $items[] = array(
      'title' => t('Weight'),
      'path' => 'admin/settings/weight',
      'access' => $access,
      'description' => t('Add weight-based sorting to nodes.'),
      'callback' => 'weight_settings_page',
    );

    // 2nd level nav (tabs)
    $items[] = array(
      'title' => t('settings'),
      'path' => 'admin/settings/weight/settings',
      'access' => $access,
      'callback' => 'weight_settings_page',
      'type' => MENU_DEFAULT_LOCAL_TASK,
    );
    $items[] = array(
      'title' => t('db setup'),
      'path' => 'admin/settings/weight/setup',
      'access' => $access,
      'callback' => 'weight_enable_page',
      'type' => MENU_LOCAL_TASK,
      'weight' => 4,
    );

    // 3rd level
    $items[] = array(
      'title' => t('enable'),
      'path' => 'admin/settings/weight/setup/enable',
      'access' => $access,
      'callback' => 'weight_enable_page',
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -2,
    );
    $items[] = array(
      'title' => t('disable'),
      'path' => 'admin/settings/weight/setup/disable',
      'access' => $access,
      'callback' => 'weight_disable_page',
      'type' => MENU_LOCAL_TASK,
      'weight' => 2,
    );
  }
  return $items;
}