Elgg  Version 4.3
PrepareBreadcrumbsHandler.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Page;
4 
11 
20  public function __invoke(\Elgg\Hook $hook) {
21  $breadcrumbs = $hook->getValue();
22 
23  // remove last crumb if not a link
24  $last_crumb = end($breadcrumbs);
25  if (empty($last_crumb['href'])) {
26  array_pop($breadcrumbs);
27  }
28 
29  // apply excerpt to text
30  foreach (array_keys($breadcrumbs) as $i) {
31  $breadcrumbs[$i]['text'] = elgg_get_excerpt($breadcrumbs[$i]['text'], 100);
32  }
33  return $breadcrumbs;
34  }
35 }
__invoke(\Elgg\Hook $hook)
Prepare breadcrumbs before display.
Models an event passed to hook handlers.
Definition: Hook.php:11
$breadcrumbs
Displays breadcrumbs.
Definition: breadcrumbs.php:22
elgg_get_excerpt($text, $num_chars=250)
Returns an excerpt.
Definition: output.php:72