You are here

function _crumbs_CrumbsPlugin__menu_router::findParent in Crumbs, the Breadcrumbs suite 6.2

Same name and namespace in other branches
  1. 6 plugins/crumbs.crumbs.inc \_crumbs_CrumbsPlugin__menu_router::findParent()

File

plugins/crumbs.crumbs.inc, line 57

Class

_crumbs_CrumbsPlugin__menu_router
This plugin allows to put information about the crumbs parent into the router item, via hook_menu() or hook_menu_alter().

Code

function findParent($path, $item) {
  if (is_string($item['crumbs_parent_callback'])) {
    $function = $item['crumbs_parent_callback'];
    if (function_exists($function)) {
      return $function($path, $item);
    }
  }
  else {
    if (is_string($item['crumbs_parent'])) {
      $replace = array();
      foreach (explode('/', $path) as $i => $fragment) {
        $replace['$' . $i] = $fragment;
      }
      return strtr($item['crumbs_parent'], $replace);
    }
  }
}