diff options
Diffstat (limited to 'views/default/navigation')
-rw-r--r-- | views/default/navigation/menu/elements/group.php | 19 | ||||
-rw-r--r-- | views/default/navigation/menu/elements/item.php | 17 | ||||
-rw-r--r-- | views/default/navigation/menu/page.php | 29 |
3 files changed, 64 insertions, 1 deletions
diff --git a/views/default/navigation/menu/elements/group.php b/views/default/navigation/menu/elements/group.php new file mode 100644 index 000000000..09474ea67 --- /dev/null +++ b/views/default/navigation/menu/elements/group.php @@ -0,0 +1,19 @@ +<?php +/** + * Menu group + * + * @uses $vars['items'] + * @uses $vars['class'] + * @uses $vars['section'] + */ + +$class = elgg_get_array_value('class', $vars, ''); +if (isset($vars['section'])) { + $class = "$class elgg-section-{$vars['section']}"; +} + +echo "<ul class=\"$class\">"; +foreach ($vars['items'] as $menu_item) { + echo elgg_view('navigation/menu/elements/item', array('item' => $menu_item)); +} +echo '</ul>'; diff --git a/views/default/navigation/menu/elements/item.php b/views/default/navigation/menu/elements/item.php index f6959b2f4..7903dbdc0 100644 --- a/views/default/navigation/menu/elements/item.php +++ b/views/default/navigation/menu/elements/item.php @@ -7,4 +7,19 @@ if ($item->getSelected()) { $class = 'class="selected"'; } -echo "<li $class>{$item->getLink()}</li>"; +$link_vars = array(); + +$children = $item->getChildren(); +if ($children) { + $link_vars['class'] = 'elgg-menu-parent elgg-menu-closed'; +} + +echo "<li $class>"; +echo $item->getLink($link_vars); +if ($children) { + echo elgg_view('navigation/menu/elements/group', array( + 'items' => $children, + 'class' => 'elgg-menu elgg-child-menu', + )); +} +echo '</li>'; diff --git a/views/default/navigation/menu/page.php b/views/default/navigation/menu/page.php new file mode 100644 index 000000000..00fa1ef51 --- /dev/null +++ b/views/default/navigation/menu/page.php @@ -0,0 +1,29 @@ +<?php +/** + * Page menu + * + * @uses $vars['menu'] + * @uses $vars['selected_item'] + * @uses $vars['class'] + */ + +$class = 'elgg-menu elgg-page-menu'; +if (isset($vars['class'])) { + $class = "$class {$vars['class']}"; +} + +if (isset($vars['selected_item'])) { + $parent = $vars['selected_item']->getParent(); + while ($parent) { + $parent->setSelected(); + $parent = $parent->getParent(); + } +} + +foreach ($vars['menu'] as $section => $menu_items) { + echo elgg_view('navigation/menu/elements/group', array( + 'items' => $menu_items, + 'section' => $section, + 'class' => $class, + )); +} |