You are here

function custom_breadcrumbsapi_preprocess in Custom Breadcrumbs 6.2

Same name and namespace in other branches
  1. 7.2 custom_breadcrumbsapi/custom_breadcrumbsapi.module \custom_breadcrumbsapi_preprocess()

Implements hook_preprocess().

File

custom_breadcrumbsapi/custom_breadcrumbsapi.module, line 172

Code

function custom_breadcrumbsapi_preprocess(&$variables, $hook) {

  // Check to see if hook has a defined custom breadcrumb.
  static $tried = array();

  // Only respond to the first call for this hook.
  if (!isset($tried[$hook])) {
    $tried[$hook] = TRUE;
    global $language;
    $languages = array(
      'language' => $language->language,
      'all' => '',
    );
    $breadcrumbs = custom_breadcrumbs_load_breadcrumbs('custom_breadcrumbsapi', NULL, array(
      'module_page' => $hook,
    ), $languages);
    if (!empty($breadcrumbs)) {
      $objs = isset($variables) && is_array($variables) ? $variables : array();
      if ($breadcrumb = custom_breadcrumbs_select_breadcrumb($breadcrumbs, $objs)) {
        custom_breadcrumbs_set_breadcrumb($breadcrumb, $objs);
        $variables['breadcrumb'] = theme('breadcrumb', drupal_get_breadcrumb());
      }
    }
  }
}