| 1 |
ADDING MENU BLOCKS
|
| 2 |
|
| 3 |
To add new menu blocks, use the "Add menu block" tab (or button) on the
|
| 4 |
administer blocks page, admin/build/block. You will then be able to
|
| 5 |
configure your menu block before adding it.
|
| 6 |
|
| 7 |
|
| 8 |
CONFIGURING MENU BLOCKS
|
| 9 |
|
| 10 |
When adding or configuring a menu block, several configuration options are
|
| 11 |
available:
|
| 12 |
|
| 13 |
Block title
|
| 14 |
For menu trees that start with the 1st level, the default block title
|
| 15 |
will be the menu name. For menu trees that start with the 2nd level or
|
| 16 |
deeper, the default block title will be the title for the parent menu
|
| 17 |
item of the specified level.
|
| 18 |
|
| 19 |
For example, if the active menu trail for the Navigation menu is:
|
| 20 |
Administer > Site building > Menus > Primary links, then a menu block
|
| 21 |
configured to start with the 1st level of the Navigation will display a
|
| 22 |
block title of "Navigation". And a menu block configured to start with
|
| 23 |
the 3rd level of the Navigation menu will display a block title of
|
| 24 |
"Site building".
|
| 25 |
|
| 26 |
Parent item
|
| 27 |
First select the menu. Then select the parent item from that menu. The
|
| 28 |
tree of links will only contain children of the selected parent item.
|
| 29 |
|
| 30 |
Starting level
|
| 31 |
Blocks that start with the 1st level will always be visible. Blocks that
|
| 32 |
start with the 2nd level or deeper will only be visible when the trail
|
| 33 |
to the active menu item is in the block's tree.
|
| 34 |
|
| 35 |
Make the starting level follow the active menu item
|
| 36 |
If the active menu item is deeper than the level specified above, the
|
| 37 |
starting level will follow the active menu item. Otherwise, the starting
|
| 38 |
level of the tree will remain fixed.
|
| 39 |
|
| 40 |
Maximum depth
|
| 41 |
From the starting level, specify the maximum depth of the tree. Blocks
|
| 42 |
with a maximum depth of 1 will just be a single un-nested list of links
|
| 43 |
with none of those links' children displayed.
|
| 44 |
|
| 45 |
Expand children
|
| 46 |
All sub-menus of this menu will be expanded.
|
| 47 |
|
| 48 |
Sort
|
| 49 |
Sort each item in the active trail to the top of its level. When used on
|
| 50 |
a deep or wide menu tree, the active menu item's children will be easier
|
| 51 |
to see when the page is reloaded.
|
| 52 |
|
| 53 |
|
| 54 |
STYLING MENU BLOCKS
|
| 55 |
|
| 56 |
Themers should look at the myriad of classes added to the <div>, <li> and
|
| 57 |
<a> elements.
|
| 58 |
|
| 59 |
<div>
|
| 60 |
The <div> wrapped around the menu tree has a class for several of the
|
| 61 |
configurable options of the block: menu-block-DELTA menu-name-NAME
|
| 62 |
parent-mlid-MLID menu-level-LEVEL
|
| 63 |
|
| 64 |
<li>
|
| 65 |
The <li> elements of the menu tree can have an extended list of classes
|
| 66 |
(compared to standard menu trees): first last menu-mlid-MLID
|
| 67 |
has-children active active-trail
|
| 68 |
|
| 69 |
<a>
|
| 70 |
The <a> elements of the menu tree can have: active active-trail
|
| 71 |
|
| 72 |
In addition, the wrapper <div> for the block is generated using the
|
| 73 |
menu-block-wrapper.tpl.php template. And Menu block provides template
|
| 74 |
suggestions of the form menu-block-wrapper-MENUNAME.tpl.php. For example, a
|
| 75 |
file in your theme called menu-block-wrapper-primary-links.tpl.php can be
|
| 76 |
used to override the <div> for just the primary-links menu blocks.
|
| 77 |
|
| 78 |
|
| 79 |
MENU BLOCK API
|
| 80 |
|
| 81 |
Developers can use the API of this module to create their own menu trees
|
| 82 |
outside the confines of blocks. All of the publicly available API functions
|
| 83 |
are documented in the menu_block.module file.
|
| 84 |
|
| 85 |
In addition, Menu block implements HOOK_get_menus() to retrieve menu names
|
| 86 |
and titles of menus created by a module. See book_get_menus() in
|
| 87 |
menu_block.book.inc for an example of this hook.
|