class _crumbs_CrumbsPlugin__menu_router in Crumbs, the Breadcrumbs suite 6
Same name and namespace in other branches
- 6.2 plugins/crumbs.crumbs.inc \_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().
Syntax in the router item: $router_item['crumbs_parent_callback'], giving a callback which takes $path and $item as arguments, and has to return the parent path. $router_item['crumbs_parent'], with $0, $1 etc being replaced with fragments from the original path.
TODO: Does this actually work? Will menu_rebuild store the information, if there is no respective table column? See http://drupal.org/node/1002116
Hierarchy
Expanded class hierarchy of _crumbs_CrumbsPlugin__menu_router
File
- plugins/
crumbs.crumbs.inc, line 45  
View source
class _crumbs_CrumbsPlugin__menu_router {
  function define($h) {
    $h
      ->setTitle('Follow the hint in the router item');
  }
  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);
      }
    }
  }
}