aboutsummaryrefslogtreecommitdiff
path: root/views/default/navigation/submenu_item.php
blob: 0e3c485ef006c9cf798218e80157e2d0aace5de3 (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
47
48
<?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
 * @author Curverider Ltd
 * @link http://elgg.org/
 */

$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>";