aboutsummaryrefslogtreecommitdiff
path: root/views/default/navigation/breadcrumbs.php
blob: d0becb367caa6e1318484a9f10cdf69296ffcd04 (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
<?php
/**
 * Displays registered breadcrumbs.
 *
 * @package Elgg
 * @subpackage Core
 * @author Curverider Ltd
 * @link http://elgg.org/
 *
 * @uses optional $vars['breadcrumbs'] = array('title' => 'The title', 'link' => 'url')
 * @see elgg_push_breadcrumb
 */

if (isset($vars['breadcrumbs'])) {
	$breadcrumbs = $vars['breadcrumbs'];
} else {
	$breadcrumbs = elgg_get_breadcrumbs();
}

$formatted_breadcrumbs = array();

foreach ($breadcrumbs as $breadcrumb) {
	$link = $breadcrumb['link'];
	$title = $breadcrumb['title'];

	if (!empty($link)) {
		$formatted_breadcrumbs[] = elgg_view('output/url', array(
			'href' => $link,
			'text' => $title
		));
	} else {
		$formatted_breadcrumbs[] = $title;
	}
}

$breadcrumbs_html = implode(' &gt; ', $formatted_breadcrumbs);

echo <<<___END

<div class="breadcrumbs">
	$breadcrumbs_html
</div>

___END;
?>