You are here

function views_set_breadcrumb in Views (for Drupal 7) 5

1 call to views_set_breadcrumb()
theme_views_view in ./views.module
Display a view.

File

./views.module, line 1476

Code

function views_set_breadcrumb($view) {
  $breadcrumb = drupal_get_breadcrumb();
  if ($view->breadcrumb_no_home) {
    array_shift($breadcrumb);
  }
  if ($view->args) {

    // Add a breadcrumb trail for each level of argument we're at.
    $url = $view->url;
    $args = array();
    $where = 1;
    foreach ($view->args as $level => $arg) {
      if ($view->argument[$level]['argdefault'] != 1) {
        $breadcrumb[] = l(filter_xss_admin(views_get_title($view, 'page', $args)), $url, NULL, NULL, NULL, NULL, TRUE);

        // For next round.
      }
      $args[] = $arg;
      if ($where && ($where = strpos($url, '$arg'))) {
        $url = substr_replace($url, $arg, $where, 4);
      }
      else {
        $url .= "/{$arg}";
      }
    }
  }
  drupal_set_breadcrumb($breadcrumb);
}