README.txt 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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 <div>, <li> and <a>
  58. elements.
  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-[block id number]
  62. menu-name-[menu name] parent-mlid-[menu link ID] menu-level-[level number]
  63. <li>
  64. The <li> 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. <a>
  68. The <a> elements of the menu tree can have: active active-trail
  69. Templates:
  70. In addition, the wrapper <div> for the block is generated using the
  71. menu-block-wrapper.tpl.php template. And Menu block provides several theme hook
  72. suggestions for that template:
  73. - menu-block-wrapper--[block id number].tpl.php
  74. - menu-block-wrapper--[menu name].tpl.php
  75. For example, a file in your theme called
  76. menu-block-wrapper--main-menu.tpl.php can be used to override the <div> for
  77. just the "Primary links" menu blocks.
  78. Theme functions:
  79. Menu block uses Drupal core's menu theme functions. However, it also provides
  80. theme hook suggestions that can be used to override any of the theme functions
  81. called by it.
  82. - theme_menu_tree() can be overridden by creating one of:
  83. - [theme]_menu_tree__[menu name]()
  84. - [theme]_menu_tree__menu_block()
  85. - [theme]_menu_tree__menu_block__[menu name]()
  86. - [theme]_menu_tree__menu_block__[block id number]()
  87. - theme_menu_link() can be overridden by creating one of:
  88. - [theme]_menu_link__[menu name]()
  89. - [theme]_menu_link__menu_block()
  90. - [theme]_menu_link__menu_block__[menu name]()
  91. - [theme]_menu_link__menu_block__[block id number]()
  92. For example, if you created a bartik_menu_tree__menu_block() function, it would
  93. override theme_menu_tree() any time it was used by this module, but not when
  94. used by any other module. Similarly, a bartik_menu_link__menu_block__1()
  95. function would override theme_menu_link(), but only for the first menu block in
  96. your system (the menu block with an ID of 1).
  97. MENU BLOCK API
  98. --------------
  99. Developers can use the API of this module to create their own menu trees outside
  100. the confines of blocks. All of the publicly available API functions are
  101. documented in the menu_block.module file.
  102. In addition, Menu block implements HOOK_menu_block_get_menus(),
  103. HOOK_menu_block_get_sort_menus() and HOOK_menu_block_tree_alter(). See
  104. menu_block.api.php for documentation.