Tuesday, January 18, 2011

Create new System Menu in Drupal

Paste in any custom module hook menu
____________________________________

$items['admin/links'] = array(
'title' => 'My Custom Links',
'description' => "Manage Custom Links.",
'position' => 'right',
'weight' => -10,
'page callback' => 'admin_display_block',
'access arguments' => array('access administration pages'),
);

$items['admin/links/websites'] = array(
'title' => t('My Custom sub link'),
'description' => "Manage Custom sub link.",
'page callback' => 'drupal_get_form',
'page arguments' => array('add_popular_website_form'),
'access callback'=>'user_access',
);

Paste in above mentioned custom module
______________________________________

function admin_display_block() {
$item = menu_get_item();
if ($content = system_admin_menu_block($item)) {
$output = theme('admin_block_content', $content);
}
else {
$output = t('You do not have any administrative items.');
}
return $output;
}

No comments:

Popular Posts