aboutsummaryrefslogtreecommitdiff
path: root/views/default/navigation/menu/elements/item.php
blob: 7b07c9485c553a5c9c82c2c53bff517b95544376 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
/**
 * A single element of a menu.
 *
 * @package Elgg.Core
 * @subpackage Navigation
 */

$item = $vars['item'];

$link_class = 'elgg-menu-closed';
if ($item->getSelected()) {
	$item->setItemClass('elgg-state-selected');
	$link_class = 'elgg-menu-opened';
}

$children = $item->getChildren();
if ($children) {
	$item->setLinkClass($link_class);
	$item->setLinkClass('elgg-menu-parent');
}

$item_class = $item->getItemClass();
if ($item_class) {
	$class = "class=\"$item_class\"";
}

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>';