Drupal Menu Block, show parent item with no children

I have been using menu block for setting the left side navigation for many of my sites and it works very well. The only problem I saw was that when a parent menu item is added with no children, the left side navigation doesn’t show up. The left side navigation shows up only when the menu item is children of a parent item or the menu item is a parent item with children.

I wanted to show left side menu block navigation for parent menu item with no children. And here is what I found from a hack on drupal forums. In the menu_block.module, comment the below lines –
/* }
else {
$data['content'] = ”;
}*/

Note: This solves your problem of displaying the parent menu item, but adds another small problem that it displays the “Main menu” title to all pages on the left sidebar. To avoid this, on your “menu block” settings page, add the below exceptions for menu block and for more pages as you see necessary.


search/*
contact-us
privacy-policy
user/*
admin/*
news/*

The menu block configuration I have set up is:
Block title as link checked.
Main Menu: Main Menu. (As I wanted left side navigation for main menu)
Starting Level: 2nd level secondary.
Fixed Parent Item: Main Menu.


No Comments so far

Leave a comment

(required)

(required)




AUTHOR

profileWeb Developer working in advertising agency.

Recent tweets

The Twitter REST API v1 is no longer active. Please migrate to API v1.1. https://dev.twitter.com/docs/api/1.1/overview.