You are here

function custom_breadcrumbs_preprocess_page in Custom Breadcrumbs 6.2

Same name and namespace in other branches
  1. 7.2 custom_breadcrumbs.module \custom_breadcrumbs_preprocess_page()

Implements hook_preprocess_page().

File

./custom_breadcrumbs.module, line 120
Provide custom breadcrumbs for node-type pages and base functionality for submodules to add custom breadcrumbs for other types of pages.

Code

function custom_breadcrumbs_preprocess_page(&$variables) {
  if (!custom_breadcrumbs_exclude_path()) {
    if (variable_get('custom_breadcrumbs_set_global_home_breadcrumb', FALSE)) {
      $trail = drupal_get_breadcrumb();
      if (!empty($trail) && strip_tags($trail[0]) == t('Home')) {

        // Replace the leading Home crumb.
        array_shift($trail);
        $cb_home = custom_breadcrumbs_home_crumb();
        if (!empty($cb_home)) {
          array_unshift($trail, array_pop($cb_home));
        }
        drupal_set_breadcrumb($trail);
        $variables['breadcrumb'] = theme('breadcrumb', drupal_get_breadcrumb());
      }
    }
  }
}