menu-tree.func.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * @file
  4. * Stub file for bootstrap_menu_tree() and suggestion(s).
  5. */
  6. /**
  7. * Returns HTML for a wrapper for a menu sub-tree.
  8. *
  9. * @param array $variables
  10. * An associative array containing:
  11. * - tree: An HTML string containing the tree's items.
  12. *
  13. * @return string
  14. * The constructed HTML.
  15. *
  16. * @see template_preprocess_menu_tree()
  17. * @see theme_menu_tree()
  18. *
  19. * @ingroup theme_functions
  20. */
  21. function bootstrap_menu_tree(&$variables) {
  22. return '<ul class="menu nav">' . $variables['tree'] . '</ul>';
  23. }
  24. /**
  25. * Bootstrap theme wrapper function for the primary menu links.
  26. */
  27. function bootstrap_menu_tree__primary(&$variables) {
  28. return '<ul class="menu nav navbar-nav">' . $variables['tree'] . '</ul>';
  29. }
  30. /**
  31. * Bootstrap theme wrapper function for the secondary menu links.
  32. */
  33. function bootstrap_menu_tree__secondary(&$variables) {
  34. return '<ul class="menu nav navbar-nav secondary">' . $variables['tree'] . '</ul>';
  35. }
  36. /**
  37. * Overrides theme_menu_tree() for book module.
  38. */
  39. function bootstrap_menu_tree__book_toc(&$variables) {
  40. $output = '<div class="book-toc btn-group pull-right">';
  41. $output .= ' <button type="button" class="btn btn-link dropdown-toggle" data-toggle="dropdown">';
  42. $output .= t('!icon Outline !caret', array(
  43. '!icon' => _bootstrap_icon('list'),
  44. '!caret' => '<span class="caret"></span>',
  45. ));
  46. $output .= '</button>';
  47. $output .= '<ul class="dropdown-menu" role="menu">' . $variables['tree'] . '</ul>';
  48. $output .= '</div>';
  49. return $output;
  50. }
  51. /**
  52. * Overrides theme_menu_tree() for book module.
  53. */
  54. function bootstrap_menu_tree__book_toc__sub_menu(&$variables) {
  55. return '<ul class="dropdown-menu" role="menu">' . $variables['tree'] . '</ul>';
  56. }