You are here

function custom_breadcrumbs_preprocess_page in Custom Breadcrumbs 7.2

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

Implements hook_preprocess_page().

File

./custom_breadcrumbs.module, line 147
Main file for the Custom breadcrumbs.

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', array(
          'breadcrumb' => drupal_get_breadcrumb(),
        ));
      }
    }
  }
}