You are here

function custom_breadcrumbsapi_breadcrumb_alter in Custom Breadcrumbs 6.2

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

Implements hook_breadcrumb_alter().

Provide a function for module developers to provide custom breadcrumbs for module pages. Modules wishing to provide custom breadcrumbs access to specific pages should include drupal_alter('breadcrumb', $breadcrumb, $modulepage, $objs); at the end of the function providing the page.

Parameters

$breadcrumb: The breadcrumb array to be altered

$modulepage: a string identifying the module page. This name will be displayed on the customb breadcrumb list.

$objs: an array of objects that can be used in token replacement with array keys indicating the type of object.

File

custom_breadcrumbsapi/custom_breadcrumbsapi.module, line 93

Code

function custom_breadcrumbsapi_breadcrumb_alter($breadcrumb, $modulepage, $objs = array()) {
  global $language;
  $languages = array(
    'language' => $language->language,
    'all' => '',
  );
  $breadcrumbs = custom_breadcrumbs_load_breadcrumbs('custom_breadcrumbsapi', NULL, array(
    'module_page' => $modulepage,
  ), $languages);
  if (!empty($breadcrumbs)) {
    if ($breadcrumb = custom_breadcrumbs_select_breadcrumb($breadcrumbs, $objs)) {
      custom_breadcrumbs_set_breadcrumb($breadcrumb, $objs);

      // Return the modified breadcrumb which has now been set.
      $breadcrumb = drupal_get_breadcrumb();
    }
  }
}