Drupal 7 Tutorial Part 10: Advanced Drupal 7 menu settings, how to create parent child menus, node menu settings.

posted Jun 28, 2011, 12:41 AM by magic stone   [ updated Jun 28, 2011, 12:53 AM ]

Hi Drupalers,

Till now we saw various menu related concepts in Drupal 7. It's time to learn some advanced settings. In this tutorial we are going to learn following concepts.

  • Drupal 7 global menu settings.
  • How to create hierarchy of menu (Parent / child) links.
  • Node Specific menu settings.

Global Menu Settings:

             In drupal 7, special settings are available for menus. Basically using these settings we can change the menus for Main Links & Secondary links in the default theme. Main Links & Secondary links positions are shown in the below screen.


  • Login as administrator, click on Structure link on top black menu, and then menu link. You will see screen like below.
  • Click on settings tab next to list menus tab in above screen to access menus global settings page. Once you click on settings tab, you will see screen like below.
  • As you see in above screen, you can set source for Main links and secondary links section. By default, Main Menu is used for main links section and user menu is used for secondary links sections.
  • You can change the menus for main, secondary links sections using this form.
  • You can pick any menu for main or secondary links sections from all available menus.
  • To see this settings in action let's interchange the menus for these sections. Let's select user menu for Main links and Main menu for Secondary links and click on save configuration button.
  • If you go to home page you will see something like below screen.
  • As you see in above screen, after saving menu settings you can observe main links menu section is showing user menu and secondary links section is showing main menu. So basically using above settings you can configure different menus for main links and secondary links menu placeholders.

How to create hierarichal menu (Parent / child) links ?

  • Till now we created only one level of menus. It's time to create hierarichal menus or menus with parent child links.
  • We are going to add some hierarichal links to the menu we created previously in this tutorial.
  • Access the links of menu links that we created earlier in the above mentioned url.
  • To access the list click on structure link in top menu black navigation bar after logging as admin. Then, click on menus link in the popup. In the menus listing page click on list links link next to Administration shortcuts menu that we created here. You will see page like below.

 

  • Let's now add a menu link called add new block as a child of Blocks listing page link in the above administration shortcuts menu.
  • First let's create the menu link Add new block and link it to admin/structure/block/add .
    Todo this click on Add link + icon in the above screen.
  • Then fill the add link form as show in below image and click on save.
  • Once you click on save new menu link is created for Administration shortcuts menu and now its time to associate parent menu child relationship. Once menu link is saved you will see screen like below.

  • Now move your mouse to + icon infront of Add new block link in above screen, Then click and hold right mouse button and drag the link above user listing below blocks landing page and then without leaving right mouse button again drag the link to right side.
  • Once you drag the link to right of some link the link will become child of above link. Once you do as mentioned above you will see screen exactly  like below.
  • Now click on save configuration button to save the link and order. We created a child link called add new block which has parent blocks landing page.
  • Unfortunately there is a core bug in drupal 7 which prevents rendering parent child relationship in a proper format for custom menus. For more details follow this link. http://drupal.org/node/942782
  • Once above bug is fixed you will see something like in comment # 17 first image in the above link. I will keep you update regarding this.

Node Menu Settings:

  • A menu item link for a node can be directly created from the node edit page using menu settings for node.
  • Node menu settings gives you option to select the menu where that particular node link appears as a menu item.
  • Let's get into the action to test this feature.
  • Goto any node edit page. Let's say node/2/edit page. You will see screen like below if you already created a node.

 

  • You can see a check box in the menu settings tab which gives you option to create a menu link for the node that you are editing.
  • Check this link to see more settings. Once you check this link you will see screen like below.
  • Now leave the title as "Article One". Add description saying "My First Article" and click on save link to create a menu link in the main menu Menu. Once you save the settings you can see menu link appearing in the main menu as shown below.

 

  • So now we created a menu link for node directly from node edit page.

 

Stay tuned with me to learn Drupal 7.

 

Cheers,

AnilSagar.

Comments