Tuesday, May 17, 2011

Create new Global Menu in Drupal

Create a new Global Menu in Drupal like Content management, Site building, Site configuration etc.. After create this menu Click on the Dashboard link in the Admin panel.  You can see the new menus.

/**
 * Implementation of hook_menu().
 */
function addons_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',
        );
}

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;
}

function add_popular_website_form(){
 drupal_set_message("Coming soon..");
}

No comments:

Post a Comment

Followers