Skip to content

Instantly share code, notes, and snippets.

@tsavory
Created June 6, 2012 21:37
Show Gist options
  • Save tsavory/2884988 to your computer and use it in GitHub Desktop.
Save tsavory/2884988 to your computer and use it in GitHub Desktop.
Adding admin menu and sub Tabs
When adding menus and tabs remeber you have to use the MENU_DEFAULT_LOCAL_TASK to get Tab to show up
So this
function djehouti_menu() {
$links = array();
// Dashboard
$links['admin/djehouti'] = array(
'title' => 'Djehouti',
'description' => 'Dashboard page',
'page callback' => 'djehouti_page_dashboard',
'page arguments' => array(),
'access arguments' => array('administer users'),
'type' => MENU_NORMAL_ITEM,
);
// TEMP : Visitor Add
$links['admin/djehouti/visitors/add'] = array(
'title' => 'Add new Visitor',
'page callback' => 'djehouti_page_visitors_add',
'access arguments' => array('administer users'),
'weight' => 1,
'weight' => 1,
'type' => MENU_LOCAL_TASK,
//'file' => 'visitors.pages.inc',
);
// Visitor Dashboard
$links['admin/djehouti/visitors'] = array(
'title' => 'Manage Visitors',
'Description' => 'Manage Visitors',
'page callback' => 'djehouti_page_visitors_dashboard',
'access arguments' => array('administer users'),
'weight' => 1,
'type' => MENU_LOCAL_TASK,
);
return $links;
}
Turns to this
function djehouti_menu() {
$links = array();
// Dashboard
$links['admin/djehouti'] = array(
'title' => 'Djehouti',
'description' => 'Dashboard page',
'page callback' => 'djehouti_page_dashboard',
'page arguments' => array(),
'access arguments' => array('administer users'),
'type' => MENU_NORMAL_ITEM,
);
// TEMP : Visitor Add
$links['admin/djehouti/visitors/add'] = array(
'title' => 'Add new Visitor',
'page callback' => 'djehouti_page_visitors_add',
'access arguments' => array('administer users'),
'weight' => 1,
'weight' => 1,
'type' => MENU_DEFAULT_LOCAL_TASK,
//'file' => 'visitors.pages.inc',
);
// Visitor Dashboard
$links['admin/djehouti/visitors'] = array(
'title' => 'Manage Visitors',
'Description' => 'Manage Visitors',
'page callback' => 'djehouti_page_visitors_dashboard',
'access arguments' => array('administer users'),
'weight' => 1,
'type' => MENU_LOCAL_TASK,
);
return $links;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment