Creating a new Drupal menu
There may come a point when a menu has become to large and unwieldy to manage and needs to broken into a number of smaller sub menus. Each chunk in the original menu then has to be moved to its new menu location
This procedure is for administrators only
The procedure is in four parts
- Create a new menu
- Move existing content to that new menu.
- ** Create the current menu block.
- Make the new menu available.
** Step 3 needs to be performed once only, the first time this procedure is carried out, if you need to create further sub menus, this menu block will already be in place, so this step is skipped.
In addition, you will also need to use the blocks page to create a menu block.
1.0 create a new menu
For this example,the menu to be split up is the Primary links menu which contains the following sections (or subtree), HTML,XML and CSS. The menu subtree to be moved is the XML block.
Go to administer > menus. As this example shows, we are starting with just the three standard menus. Click the add menu tab.
The Add menu page is shown below. Give the menu a name. Note the name can only use lowercase characters, and must be unique. Next give it a title, and although optional, its a good idea to provide a description, to indicate the scope of menu.
When you are done, save this page, to create the new menu, and as the return page indicates, at this stage there are no menu items. This completes the first step.If you return to previous page which listed the existing menus, you should now see the new menu.
2.0 Moving existing content to a new menu
Go to the menu to split, i.e. Admin/build/menus/primary links. Locate the parent node of the sub tree to be moved. (See below). In this case the parent node is called XML overview, and it has one sub node called XML introduction, though usually it will be many more, to make this a worthwhile. The example also shows the two surrounding menu items which we are not interested in (HTML glossary and CSS overview).
Click the edit button of the parent node (XML overview). The only part of this page we are interested in is the parent menu. Use the drop down box and select the new menu, as shown.
Save the change. If you go back to the menu list page, and select the new menu, you should now see the menu populated with parent item and the whole of its sub tree. Also notice the parent item in the original menu and its sub tree have now gone.
At this point you now have two separate menus. For this procedure to work properly they need to be linked together via the parent node
Open the original menu (primary links) and click the add item tab.
At this stage its perhaps a good idea to open another tab in your browser to view the parent node in the new (in this case XML) menu. Since the page we want to add already exists you need its path name. Enter this, along with a menu link title, and optionally a description. E.g.use copy and paste from the original to the new item item.
Make sure the new menu item, is correctly linked to its parent item and save it. You should now have two menu links to the same node. One in the primary links menu, the other in the new XML menu.
3.0 Create (or configure) the menu block
First check if the Current menu (levels + 1) block exists in the left sidebar. Go to admin/build/blocks and look for the left sidebar. The left sidebar should look similar to the image below. If it contains the Current menu (levels + 1) block then all is well and you do not have to create this block and can skip this step.
The creation of this block is done only once, the first time this procedure is carried out
If however it doesn't contain this block but some other menu block instead, e.g. Primary links, Linux then you will have to create it.
The current menu block isn't there, so it must be created for the first time. Click the Add menu block to obtain the page below.
Give the menu a title, lets call it "Topics".
The administrative title field can be left blank.
Use the drop down menu to select the menu selected by the page option.
For this example make sure the Starting level is 1st level (primary)
Leave the next option unchecked (as shown).
Check the Maximum depth is unlimited
The remaining options should be set as show below. Check that the fix parent item drop down box is set to the menu selected by the page
Save the form. Return to the block regions where you should find the new block among the disabled blocks at near the bottom of page.
Click the region option for the current menu (level + 1) block and move it to the left sidebar. Repeat this for existing menu block (i.e. primary links) and set the region to none, to disable the block. Finally rearrange the blocks so that the new block is at the top
4 Make the new menu available
Your menu block settings should look similar to those shown below. The newly created (sub) menu is at the bottom of the list, below the first level primary links menu. Use the drag and drop handle to move this block to the top of the list and use the tick box to check it, making it available.
Drupal will search through all menu blocks in order, from top to bottom, stopping at the first menu block it finds containing the selected page. Menu blocks should therefore start with the lowest (sub menu) up to the parent menu
Save the page, and you are finished.
The order of sub menus within the same level, may not be important initially. So for example if we went on and created other sub menus for HTML, CSS content as well as XML their order doesn't matter. What is important is that they all appear above the primary links (or parent men) in the list. If you suspect, or know, that majority od searches are for CSS, then you might but this block above XML, to minimise the number of blocks being searched.