You are here

README.txt in Menu Block 7.3

Same filename and directory in other branches
  1. 8 README.txt
  2. 6.2 README.txt
  3. 7.2 README.txt
ADDING MENU BLOCKS
------------------

To add new menu blocks, use the "Add menu block" link on the administer blocks
page, admin/structure/block. You will then be able to configure your menu block
before adding it.


CONFIGURING MENU BLOCKS
-----------------------

When adding or configuring a menu block, several configuration options are
available:

Basic Options:

Block title
  For menu trees that start with the 1st level, the default block title will be
  the menu name. For menu trees that start with the 2nd level or deeper, the
  default block title will be the title for the parent menu item of the
  specified level.

  For example, if the active menu trail for the Management menu is: Administer >
  Structure > Menus > Main menu, then a menu block configured to start with the
  1st level of the Management menu will display a block title of "Management".
  And a menu block configured to start with the 3rd level of the Management menu
  will display a block title of "Structure".

Block title as link
  For menu trees that start with the 2nd level or deeper, the default block
  title will be the title for the parent menu item of the specified level. If
  this option is checked, the block title will be a link to that menu item.

Administrative title
  To help identify the block on the administer blocks page, you can specify a
  unique title to be used on that page. If blank, the regular title will be
  used.

Menu name
  Select the menu to use for the tree of links.

Starting level
  Blocks that start with the 1st level will always be visible. Blocks that start
  with the 2nd level or deeper will only be visible when the trail to the active
  menu item is in the block's tree.

Maximum depth
  From the starting level, specify the maximum depth of the tree. Blocks with a
  maximum depth of 1 will just be a single un-nested list of links with none of
  those links' children displayed.

Advanced options:

Make the starting level follow the active menu item
  If the active menu item is deeper than the level specified above, the starting
  level will follow the active menu item. Otherwise, the starting level of the
  tree will remain fixed.

Expand
  All children of this menu will be expanded.

Sort
  Sort each item in the active trail to the top of its level. When used on a
  deep or wide menu tree, the active menu item's children will be easier to see
  when the page is reloaded.

Fixed parent item
  If you select a specific menu item, you alter the "starting level" and
  "maximum depth" options to be relative to the fixed parent item. The tree of
  links will only contain children of the selected parent item.


STYLING MENU BLOCKS
-------------------

Classes:

Themers should look at the myriad of classes added to the <div>, <li> and <a>
elements.

<div>
  The <div> wrapped around the menu tree has a class for several of the
  configurable options of the block: menu-block-[block id number]
  menu-name-[menu name] parent-mlid-[menu link ID] menu-level-[level number]

<li>
  The <li> elements of the menu tree can have an extended list of classes
  (compared to standard menu trees): first last menu-mlid-[menu link ID]
  has-children active active-trail

<a>
  The <a> elements of the menu tree can have: active active-trail

Templates:

In addition, the wrapper <div> for the block is generated using the
menu-block-wrapper.tpl.php template. And Menu block provides several theme hook
suggestions for that template:
- menu-block-wrapper--[block id number].tpl.php
- menu-block-wrapper--[menu name].tpl.php

For example, a file in your theme called
menu-block-wrapper--main-menu.tpl.php can be used to override the <div> for
just the "Primary links" menu blocks.

Theme functions:

Menu block uses Drupal core's menu theme functions. However, it also provides
theme hook suggestions that can be used to override any of the theme functions
called by it.

- theme_menu_tree() can be overridden by creating one of:
  - [theme]_menu_tree__[menu name]()
  - [theme]_menu_tree__menu_block()
  - [theme]_menu_tree__menu_block__[menu name]()
  - [theme]_menu_tree__menu_block__[block id number]()

- theme_menu_link() can be overridden by creating one of:
  - [theme]_menu_link__[menu name]()
  - [theme]_menu_link__menu_block()
  - [theme]_menu_link__menu_block__[menu name]()
  - [theme]_menu_link__menu_block__[block id number]()

For example, if you created a bartik_menu_tree__menu_block() function, it would
override theme_menu_tree() any time it was used by this module, but not when
used by any other module. Similarly, a bartik_menu_link__menu_block__1()
function would override theme_menu_link(), but only for the first menu block in
your system (the menu block with an ID of 1).


MENU BLOCK API
--------------

Developers can use the API of this module to create their own menu trees outside
the confines of blocks. All of the publicly available API functions are
documented in the menu_block.module file.

In addition, Menu block implements HOOK_menu_block_get_menus(),
HOOK_menu_block_get_sort_menus() and HOOK_menu_block_tree_alter(). See
menu_block.api.php for documentation.

File

README.txt
View source
  1. ADDING MENU BLOCKS
  2. ------------------
  3. To add new menu blocks, use the "Add menu block" link on the administer blocks
  4. page, admin/structure/block. You will then be able to configure your menu block
  5. before adding it.
  6. CONFIGURING MENU BLOCKS
  7. -----------------------
  8. When adding or configuring a menu block, several configuration options are
  9. available:
  10. Basic Options:
  11. Block title
  12. For menu trees that start with the 1st level, the default block title will be
  13. the menu name. For menu trees that start with the 2nd level or deeper, the
  14. default block title will be the title for the parent menu item of the
  15. specified level.
  16. For example, if the active menu trail for the Management menu is: Administer >
  17. Structure > Menus > Main menu, then a menu block configured to start with the
  18. 1st level of the Management menu will display a block title of "Management".
  19. And a menu block configured to start with the 3rd level of the Management menu
  20. will display a block title of "Structure".
  21. Block title as link
  22. For menu trees that start with the 2nd level or deeper, the default block
  23. title will be the title for the parent menu item of the specified level. If
  24. this option is checked, the block title will be a link to that menu item.
  25. Administrative title
  26. To help identify the block on the administer blocks page, you can specify a
  27. unique title to be used on that page. If blank, the regular title will be
  28. used.
  29. Menu name
  30. Select the menu to use for the tree of links.
  31. Starting level
  32. Blocks that start with the 1st level will always be visible. Blocks that start
  33. with the 2nd level or deeper will only be visible when the trail to the active
  34. menu item is in the block's tree.
  35. Maximum depth
  36. From the starting level, specify the maximum depth of the tree. Blocks with a
  37. maximum depth of 1 will just be a single un-nested list of links with none of
  38. those links' children displayed.
  39. Advanced options:
  40. Make the starting level follow the active menu item
  41. If the active menu item is deeper than the level specified above, the starting
  42. level will follow the active menu item. Otherwise, the starting level of the
  43. tree will remain fixed.
  44. Expand
  45. All children of this menu will be expanded.
  46. Sort
  47. Sort each item in the active trail to the top of its level. When used on a
  48. deep or wide menu tree, the active menu item's children will be easier to see
  49. when the page is reloaded.
  50. Fixed parent item
  51. If you select a specific menu item, you alter the "starting level" and
  52. "maximum depth" options to be relative to the fixed parent item. The tree of
  53. links will only contain children of the selected parent item.
  54. STYLING MENU BLOCKS
  55. -------------------
  56. Classes:
  57. Themers should look at the myriad of classes added to the
    ,
  58. and
  59. elements.
  60. The
    wrapped around the menu tree has a class for several of the
  61. configurable options of the block: menu-block-[block id number]
  62. menu-name-[menu name] parent-mlid-[menu link ID] menu-level-[level number]
  63. The
  64. elements of the menu tree can have an extended list of classes
  65. (compared to standard menu trees): first last menu-mlid-[menu link ID]
  66. has-children active active-trail
  67. The elements of the menu tree can have: active active-trail
  68. Templates:
  69. In addition, the wrapper
    for the block is generated using the
  70. menu-block-wrapper.tpl.php template. And Menu block provides several theme hook
  71. suggestions for that template:
  72. - menu-block-wrapper--[block id number].tpl.php
  73. - menu-block-wrapper--[menu name].tpl.php
  74. For example, a file in your theme called
  75. menu-block-wrapper--main-menu.tpl.php can be used to override the
    for
  76. just the "Primary links" menu blocks.
  77. Theme functions:
  78. Menu block uses Drupal core's menu theme functions. However, it also provides
  79. theme hook suggestions that can be used to override any of the theme functions
  80. called by it.
  81. - theme_menu_tree() can be overridden by creating one of:
  82. - [theme]_menu_tree__[menu name]()
  83. - [theme]_menu_tree__menu_block()
  84. - [theme]_menu_tree__menu_block__[menu name]()
  85. - [theme]_menu_tree__menu_block__[block id number]()
  86. - theme_menu_link() can be overridden by creating one of:
  87. - [theme]_menu_link__[menu name]()
  88. - [theme]_menu_link__menu_block()
  89. - [theme]_menu_link__menu_block__[menu name]()
  90. - [theme]_menu_link__menu_block__[block id number]()
  91. For example, if you created a bartik_menu_tree__menu_block() function, it would
  92. override theme_menu_tree() any time it was used by this module, but not when
  93. used by any other module. Similarly, a bartik_menu_link__menu_block__1()
  94. function would override theme_menu_link(), but only for the first menu block in
  95. your system (the menu block with an ID of 1).
  96. MENU BLOCK API
  97. --------------
  98. Developers can use the API of this module to create their own menu trees outside
  99. the confines of blocks. All of the publicly available API functions are
  100. documented in the menu_block.module file.
  101. In addition, Menu block implements HOOK_menu_block_get_menus(),
  102. HOOK_menu_block_get_sort_menus() and HOOK_menu_block_tree_alter(). See
  103. menu_block.api.php for documentation.