section.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * Menu group
  4. *
  5. * @uses $vars['items'] Array of menu items
  6. * @uses $vars['class'] Additional CSS class for the section
  7. * @uses $vars['name'] Name of the menu
  8. * @uses $vars['section'] The section name
  9. * @uses $vars['item_class'] Additional CSS class for each menu item
  10. * @uses $vars['show_section_headers'] Do we show headers for each section
  11. */
  12. $items = elgg_extract('items', $vars, array());
  13. $headers = elgg_extract('show_section_headers', $vars, false);
  14. $class = elgg_extract('class', $vars, '');
  15. $item_class = elgg_extract('item_class', $vars, '');
  16. if ($headers) {
  17. $name = elgg_extract('name', $vars);
  18. $section = elgg_extract('section', $vars);
  19. echo '<h2>' . elgg_echo("menu:$name:header:$section") . '</h2>';
  20. }
  21. echo "<ul class=\"$class\">";
  22. if (is_array($items)) {
  23. foreach ($items as $menu_item) {
  24. echo elgg_view('navigation/menu/elements/item', array(
  25. 'item' => $menu_item,
  26. 'item_class' => $item_class,
  27. ));
  28. }
  29. }
  30. echo '</ul>';