item.php 1021 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * A single element of a menu.
  4. *
  5. * @package Elgg.Core
  6. * @subpackage Navigation
  7. *
  8. * @uses $vars['item'] ElggMenuItem
  9. * @uses $vars['item_class'] Additional CSS class for the menu item
  10. */
  11. $item = $vars['item'];
  12. $link_class = 'elgg-menu-closed';
  13. if ($item->getSelected()) {
  14. // @todo switch to addItemClass when that is implemented
  15. //$item->setItemClass('elgg-state-selected');
  16. $link_class = 'elgg-menu-opened';
  17. }
  18. $children = $item->getChildren();
  19. if ($children) {
  20. $item->addLinkClass($link_class);
  21. $item->addLinkClass('elgg-menu-parent');
  22. }
  23. $item_class = $item->getItemClass();
  24. if ($item->getSelected()) {
  25. $item_class = "$item_class elgg-state-selected";
  26. }
  27. if (isset($vars['item_class']) && $vars['item_class']) {
  28. $item_class .= ' ' . $vars['item_class'];
  29. }
  30. echo "<li class=\"$item_class\">";
  31. echo elgg_view_menu_item($item);
  32. if ($children) {
  33. echo elgg_view('navigation/menu/elements/section', array(
  34. 'items' => $children,
  35. 'class' => 'elgg-menu elgg-child-menu',
  36. ));
  37. }
  38. echo '</li>';