You are here

function custom_breadcrumbs_paths_views_pre_render in Custom Breadcrumbs 7.2

Same name and namespace in other branches
  1. 6.2 custom_breadcrumbs_paths/custom_breadcrumbs_paths.module \custom_breadcrumbs_paths_views_pre_render()

Implements hook_views_pre_render().

File

custom_breadcrumbs_paths/custom_breadcrumbs_paths.module, line 101

Code

function custom_breadcrumbs_paths_views_pre_render(&$view) {

  // Don't really do anything with the view. This is just a pretense to insert a
  // breadcrumb.
  $curpath = drupal_get_normal_path($_GET['q']);

  // Check to see if the view path matches the current path.
  $viewpage = FALSE;
  foreach ($view->display as $display) {

    // We're only interested in main page views.
    if (!_custom_breadcrumbs_allowed_display($display)) {
      continue;
    }
    $viewpath = _custom_breadcrumbs_construct_view_path($display);
    $viewpage = $viewpage || _custom_breadcrumbs_match_path($curpath, $viewpath);
  }
  if ($viewpage) {

    // Check for breadcrumb at this path and set if a match is found.
    // Views have a higher priority than theme templates, but lower than nodes.
    _custom_breadcrumbs_paths_set_breadcrumb(array(
      'view' => $view,
    ), 2);
  }
}