You are here

function menu_trail_by_path_page_delivery_callback_alter in Menu Trail By Path 7.3

Same name and namespace in other branches
  1. 7.2 menu_trail_by_path.module \menu_trail_by_path_page_delivery_callback_alter()

Implements hook_page_delivery_callback_alter().

This is the only hook that occurs after the page callback, but before hook_page_build (when blocks are added). We're using this hook for its timing, not its data.

File

./menu_trail_by_path.module, line 23
Expand menu items and set active-trail according to current path.

Code

function menu_trail_by_path_page_delivery_callback_alter() {
  global $language;
  menu_trail_by_path_fix_cache_after_upgrade();
  $urlHelper = new MenutrailbypathUrlHelper();
  $pathHelper = new MenutrailbypathPathHelper();
  $menuHelper = new MenutrailbypathMenuHelper($language, $urlHelper);

  // Set the active-trail for each menu containing one of the candidates.
  if (menu_trail_by_path_is_active('menu_trail')) {
    $activetrail = new MenutrailbypathActivetrail($pathHelper, $menuHelper, $urlHelper);
    $activetrail
      ->setActivetrails();
  }

  // Set the breadcrumbs according to path URL if it is enabled in the UI.
  if (menu_trail_by_path_is_active('breadcrumb')) {
    $breadcrumb = new MenutrailbypathBreadcrumb($pathHelper, $menuHelper);
    $breadcrumb
      ->setBreadcrumb();
  }
}