Working With Menus in Drupal 7

Drupal allows us to create navigational links through menu module. Through this we can create multi level menus, In these menus we can add different types of navigational items like nodes, pages, content types, views, taxonomy terms or any other items. After creating a menu, it will create a block with the same name as menu. After that these blocks can be placed on any region of your website.

Working With Menus in Drupal 7 is an article in the series of Step by step guide to learn drupal7.

#Part 2 @ Day 3

Here in Working With Menus in Drupal 7 you’ll learn these

  • Creating Menu’s in Drupal 7
  • Editing the Menus’s
  • Renaming the Menu’s
  • Removing the Menu’s
1

Creating a menu

While Creating menu in drupal, It includes two steps, first one is we need to add menu, then we need to add menu links to that menu, and that’s all for creating a menu.

  1. Navigate to the Menus page (Structure > Menus or http://example.com/admin/structure/menu).
  2. Click Add menu.
  3. In the Title field, enter a title.
  4. In the Description field, enter an optional description.
  5. Click Save.
Creating Menu in Drupal 7 Step One

Creating Menu in Drupal 7 Step One

Creating Menu in Drupal 7 step two

Creating Menu in Drupal 7 step two

After creating menu, you need to add links. For adding links to menu follow these steps.

  1. Navigate to the Menus page (Structure > Menus or http://example.com/admin/structure/menu).
  2. Locate a menu to edit and click add link.
    Adding Menu links to Drupal 7 Menu Step One

    Adding Menu links to Drupal 7 Menu Step One

  3. In the Menu link title field, enter the title as it will be displayed in the menu.
    Adding Menu links to Drupal 7 Menu Step Two

    Adding Menu links to Drupal 7 Menu Step Two

  4. In the Path field, enter a path for the link. This can be an internal Drupal path such as node/add (see “Before you begin” above) or an external URL such as http://example.com. Enter <front> to link to the front page.
  5. In the Description field, enter the text that will be displayed when a user hovers over the link.
  6. Enable any of the following options:
    • Enabled: If the link is not enabled, it will not be displayed in the menu.
    • Expanded: If this option is enabled and the menu link has children, the menu will always appear expanded.
  7. In the Parent link list, select the parent of the link.
  8. (Optional) In the Weight list, select the relative weight of the link. Links with the “lightest” weight will display higher in a menu. Links with the same weight will display in alphabetical order.
  9. Click Save.
  10. After adding menu link, you can see it from Structure => Menus => Menu you have created => List Links.
    Adding Menu links to Drupal 7 Menu Step Three

    Adding Menu links to Drupal 7 Menu Step Three

2

Enable the menu

Assuming you plan to add nodes to your menu and not just external links, you must enable it in the content type for the node(s) that will be the target of the menu’s links. It is possible to add menu links that are not enabled this way through the Menus page. If you do, you will find that certain changes cause your link to disappear from the assigned menu. Menus can be enabled on multiple content types.

Working with Menus in Drupal 7

Menu Drupal 7 Enable Menu

  1. Navigate to the content type for the node(s) (Structure > Content type or http://example.com/admin/structure/types).
  2. Locate the content type and click edit.
  3. Choose Menu settings.
  4. Click the checkbox of the menu(s) you want to enable.
  5. (Optional) Set the Default parent item to choose a default menu for the content type.

Specify the menus to use for main and secondary links

Working with Menus in Drupal 7

Menu Drupal 7 specify menu

  1. Navigate to the Menu settings page (/admin/structure/menu/settings).
  2. Specify any of the following settings:
    • Source for the main links: The menu that will provide the “main links”. In many themes, the main links are displayed at the top of the page.
    • Source for the secondary links : The menu that will provide the “secondary links”. In many themes, the secondary links are displayed at the bottom of the page.
  3. Click Save configuration.
3

Renaming menus & Updating Links

Here there are two things one is renaming the menu, most probably you won’t do this regularly.

Next one is updating the menu links, this we need often to change menu paths and navigational links.

Renaming Menu

  1. Navigate to the Menus page (/admin/structure/menu).
    Renaming Drupal 7 Menu

    Renaming Drupal 7 Menu

  2. Click Edit Menu.
  3. In the Title field, enter a new title.
  4. Click Save.

Updating Menu Links

  1. Navigate to the Menus page (/admin/structure/menu).
    Renaming Drupal 7 Menu Links

    Renaming Drupal 7 Menu Links

  2. Click List Links.
  3. On this screen, it will show all the available links
  4. Next to Menu link item under operations, click on edit link .
  5. From the next screen, you can update links as per step one.
  6. Click Save.

Note: The default menus cannot be renamed.

4

Removing a menu & Menu Links in Drupal 7

Here we can remove Complete Menu, and also individual menu links. If you delete Complete Menu all the individual links will be deleted.

Removing a Menu in Drupal 7

  1. Navigate to the Menus page (/admin/structure/menu).
  2. Click Edit Menu.
    Remoing Drupal 7 Menu Step One

    Remoing Drupal 7 Menu Step One

  3. Click Delete.
    Removing Menu in drupal 7 Step Two

    Removing Menu in drupal 7 Step Two

  4. Click Delete again to confirm.

Removing a Menu Links in Drupal 7

  1. Navigate to the Menus page (/admin/structure/menu).
  2. Click List Links.

    Removing Menu Links In Drupal 7 Step One

    Removing Menu Links In Drupal 7 Step One

  3. On this screen, you can see the individual links.
  4. Click on Delete, right next to menu links under operations.
    Removing Menu Links in Drupal 7 step two

    Removing Menu Links in Drupal 7 step two

  5. Click Delete again to confirm.

Note: The default menus cannot be deleted.

I hope this article helped you to lean working with menus in drupal 7. To get latest news and updates follow us on twitter & facebook, subscribe to newsletter. If you have any feedback please let us know by using comment form.

Vivek Vengala
 

Vivek Vengala is a Online Entrepreneur, Web Developer from Hyderabad India.

Click Here to Leave a Comment Below 0 comments

Leave a Reply:

x

Join My Facebook Group to Receive Coding Tutorial for Free

email-subsribe