Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
breadcrumbs.php
Go to the documentation of this file.
1 <?php
15 if (isset($vars['breadcrumbs'])) {
16  $breadcrumbs = $vars['breadcrumbs'];
17 } else {
18  $breadcrumbs = elgg_get_breadcrumbs();
19 }
20 
21 $class = 'elgg-menu elgg-breadcrumbs';
23 if ($additional_class) {
24  $class = "$class $additional_class";
25 }
26 
27 if (is_array($breadcrumbs) && count($breadcrumbs) > 0) {
28  echo "<ul class=\"$class\">";
29  foreach ($breadcrumbs as $breadcrumb) {
30  // We have to escape text (without double-encoding). Titles in core plugins are HTML escaped
31  // on input, but we can't guarantee that other users of this view and of elgg_push_breadcrumb()
32  // will do so.
33  if (!empty($breadcrumb['link'])) {
34  $crumb = elgg_view('output/url', array(
35  'href' => $breadcrumb['link'],
36  'text' => $breadcrumb['title'],
37  'encode_text' => true,
38  'is_trusted' => true,
39  ));
40  } else {
41  $crumb = htmlspecialchars($breadcrumb['title'], ENT_QUOTES, 'UTF-8', false);
42  }
43  echo "<li>$crumb</li>";
44  }
45  echo '</ul>';
46 }
$vars['entity']
elgg_view($view, $vars=array(), $ignore1=false, $ignore2=false, $viewtype= '')
Return a parsed view.
Definition: views.php:342
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1310