You are here

function view::get_breadcrumb in Views (for Drupal 7) 6.2

Same name and namespace in other branches
  1. 6.3 includes/view.inc \view::get_breadcrumb()
  2. 7.3 includes/view.inc \view::get_breadcrumb()

Get the breadcrumb used for this view.

Parameters

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

File

includes/view.inc, line 1237
view.inc Provides the view object type and associated methods.

Class

view
An object to contain all of the data to generate a view, plus the member functions to build the view query, execute the query and render the output.

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 == variable_get('site_frontpage', 'node')) {
        $base = FALSE;
        $title = t('Home');
      }
      if ($title) {
        $breadcrumb[] = l($title, $path, array(
          'html' => true,
        ));
      }
    }
    if ($set) {
      if ($base) {
        $breadcrumb = array_merge(drupal_get_breadcrumb(), $breadcrumb);
      }
      drupal_set_breadcrumb($breadcrumb);
    }
  }
  return $breadcrumb;
}