diff options
Diffstat (limited to 'views/default/navigation/breadcrumbs.php')
-rw-r--r-- | views/default/navigation/breadcrumbs.php | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/views/default/navigation/breadcrumbs.php b/views/default/navigation/breadcrumbs.php new file mode 100644 index 000000000..88577a8ff --- /dev/null +++ b/views/default/navigation/breadcrumbs.php @@ -0,0 +1,41 @@ +<?php +/** + * Displays breadcrumbs. + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['breadcrumbs'] (Optional) Array of arrays with keys 'title' and 'link' + * @uses $vars['class'] + * + * @see elgg_push_breadcrumb + */ + +if (isset($vars['breadcrumbs'])) { + $breadcrumbs = $vars['breadcrumbs']; +} else { + $breadcrumbs = elgg_get_breadcrumbs(); +} + +$class = 'elgg-menu elgg-breadcrumbs'; +$additional_class = elgg_extract('class', $vars, ''); +if ($additional_class) { + $class = "$class $additional_class"; +} + +if (is_array($breadcrumbs) && count($breadcrumbs) > 0) { + echo "<ul class=\"$class\">"; + foreach ($breadcrumbs as $breadcrumb) { + if (!empty($breadcrumb['link'])) { + $crumb = elgg_view('output/url', array( + 'href' => $breadcrumb['link'], + 'text' => $breadcrumb['title'], + 'is_trusted' => true, + )); + } else { + $crumb = $breadcrumb['title']; + } + echo "<li>$crumb</li>"; + } + echo '</ul>'; +} |