diff options
Diffstat (limited to 'views/default/navigation')
-rw-r--r-- | views/default/navigation/breadcrumbs.php | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/views/default/navigation/breadcrumbs.php b/views/default/navigation/breadcrumbs.php index 8f5b52f14..67e985bed 100644 --- a/views/default/navigation/breadcrumbs.php +++ b/views/default/navigation/breadcrumbs.php @@ -1,11 +1,13 @@ <?php /** - * Displays registered breadcrumbs. + * Displays breadcrumbs. * * @package Elgg * @subpackage Core * - * @uses optional $vars['breadcrumbs'] = array('title' => 'The title', 'link' => 'url') + * @uses $vars['breadcrumbs'] (Optional) Array of arrays with keys 'title' and 'link' + * @uses $vars['class'] + * * @see elgg_push_breadcrumb */ @@ -15,29 +17,24 @@ if (isset($vars['breadcrumbs'])) { $breadcrumbs = elgg_get_breadcrumbs(); } -$formatted_breadcrumbs = array(); - -foreach ($breadcrumbs as $breadcrumb) { - $link = $breadcrumb['link']; - $title = $breadcrumb['title']; +$class = 'elgg-breadcrumbs'; +$additional_class = elgg_get_array_value('class', $vars, ''); +if ($additional_class) { + $class = "$class $additional_class"; +} - if (!empty($link)) { - $formatted_breadcrumbs[] = elgg_view('output/url', array( - 'href' => $link, - 'text' => $title - )); - } else { - $formatted_breadcrumbs[] = $title; +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'], + )); + } else { + $crumb = $breadcrumb['title']; + } + echo "<li>$crumb</li>"; } + echo '</ul>'; } - -$breadcrumbs_html = implode(' > ', $formatted_breadcrumbs); - -echo <<<___END - -<div class="elgg-breadcrumbs"> - $breadcrumbs_html -</div> - -___END; -?>
\ No newline at end of file |