Elgg  Version 1.11
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 }
elgg_extract($key, array $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1246
elgg echo
Translates a string.
Definition: languages.js:43
elgg_get_breadcrumbs()
Returns all breadcrumbs as an array of array(&#39;title&#39; => &#39;Title&#39;, &#39;link&#39; => &#39;URL&#39;) ...
Definition: navigation.php:278
elgg_view($view, $vars=array(), $bypass=false, $ignored=false, $viewtype= '')
Return a parsed view.
Definition: views.php:354
if(file_exists($welcome)) $vars
Definition: upgrade.php:93