Drupal 7: How to create a menu item / route that does not appear in site navigation

How to create a new route / menu in Drupal that does not automatically display a navigation link?

I am trying to create a simple page callback in Drupal that does not appear in the navigation menu.

I have a module named helloworld.

The file .modulecontains the following

function _helloword_page_callback()
{
    return array('#markup'=>'The quick brown fox says hello, and the lazy dogs thanks you
    for following conventions.');
}

function helloworld_menu()
{
    $items['helloworld'] = array(
      'title'               => 'Hello World',
      'page callback'       => '_helloword_page_callback',
      'access arguments'    => array('content'),
      'type'                => MENU_CALLBACK
    );
    return $items;
}

This successfully provides the URL on the site

http://example.drupal.com/helloworld

However , I still get the link in the left navigation menu (Bartik), despite using

'type'              => MENU_CALLBACK

So why is this not working? Will I set the menu item correctly? A more likely question is: how did I misinterpret the use of constants / menu type systems? Are there any additional caches to understand what

drush cc all

won't take care? What other steps can I take to debug this?

+5
2

- (, ?), Bartik , . "Hello 2":

function helloworld_menu(){
    return array(
        'hello1' => array(
            'title'               => 'Hello 1',
            'page callback'       => 'helloworld_page_callback',
            'access arguments'    => array('content'),
            'type'                => MENU_CALLBACK
        ),
        'hello2' => array(
            'title'               => 'Hello 2',
            'page callback'       => 'helloworld_page_callback',
            'access arguments'    => array('content')
        )
    );
}

function helloworld_page_callback(){
    return array('#markup'=>'The quick brown fox says hello, and the lazy dogs thanks you for following conventions.');
}

, snipplet (helloroute_menu helloworld_menu), , StackOverflow.

+5

. (, ), , , .

, .

+4

All Articles