1 view.inc view::get_breadcrumb($set = FALSE)

Get the breadcrumb used for this view.

Parameters

$set: If true, use backdrop_set_breadcrumb() to install the breadcrumb.

File

core/modules/views/includes/view.inc, line 1700
Provides the view object type and associated methods.

Class

view

Code

function get_breadcrumb($set = FALSE) {
  // Now that we've built the view, extract the breadcrumb.
  $base = TRUE;
  $breadcrumb = array();

  if (!empty($this->build_info['breadcrumb'])) {
    foreach ($this->build_info['breadcrumb'] as $path => $title) {
      // Check to see if the frontpage is in the breadcrumb trail; if it
      // is, we'll remove that from the actual breadcrumb later.
      if ($path == config_get('system.core', 'site_frontpage')) {
        $base = FALSE;
        $title = t('Home');
      }
      if ($title) {
        $breadcrumb[] = l($title, $path, array('html' => TRUE));
      }
    }

    if ($set) {
      if ($base) {
        $breadcrumb = array_merge(backdrop_get_breadcrumb(), $breadcrumb);
      }
      backdrop_set_breadcrumb($breadcrumb);
    }
  }
  return $breadcrumb;
}