aboutsummaryrefslogtreecommitdiff
path: root/views/default/navigation/submenu_item.php
blob: 09aa24a8e6ad1782ee2f2ab191146be1f3b3f7fc (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
37
38
39
40
41
42
43
44
45
46
<?php
/**
 * Elgg submenu item.  Displays the <li> part of a submenu.
 *
 * @uses $vars['group']
 * @uses $vars['item']
 * @uses $vars['children_html']
 * @package Elgg
 * @subpackage Core
 */

$group = (isset($vars['group'])) ? $vars['group'] : 'default';
$item = (isset($vars['item'])) ? $vars['item'] : FALSE;
$children_html = (isset($vars['children_html'])) ? $vars['children_html'] : '';

if ($item) {
	$has_children = (isset($item->children) && $item->children) ? TRUE : FALSE;
	$selected = (isset($item->selected) && $item->selected == TRUE) ? 'class="selected"' : '';
	$js = (isset($vars['js'])) ? $vars['js'] : '';

	$child_indicator = '';
	if ($has_children) {
		if ($selected) {
			$child_indicator = '<span class="close_child">-</span>';
			$child_indicator .= '<span class="hidden open_child">+</span>';
		} else {
			$child_indicator = '<span class="hidden close_child">-</span>';
			$child_indicator .= '<span class="open_child">+</span>';
		}

		$child_indicator = "<span class=\"child_indicator\">$child_indicator </span>";
	}

	$url = htmlentities($item->href);
	$text = $child_indicator . htmlentities($item->text);

	$link_vars = array_merge($vars, array(
		'href' => $item->href,
		'text' => $text,
		'encode_text' => FALSE
	));

	$link = elgg_view('output/url', $link_vars);
}

echo "<li $selected>$link$children_html</li>";