function crumbs_reduce_path in Crumbs, the Breadcrumbs suite 6.2
Same name and namespace in other branches
- 7.2 crumbs.module \crumbs_reduce_path()
- 7 crumbs.module \crumbs_reduce_path()
Chop off path fragments until we find a valid path.
Parameters
$path: starting path or alias
$depth: max number of fragments we try to chop off. -1 means no limit.
3 calls to crumbs_reduce_path()
File
- ./
crumbs.trail.inc, line 59
Code
function crumbs_reduce_path($path, $depth = -1) {
$fragments = explode('/', $path);
while (count($fragments) > 1 && $depth !== 0) {
array_pop($fragments);
$parent_path = implode('/', $fragments);
$parent_item = crumbs_get_router_item($parent_path);
if ($parent_item && $parent_item['href'] === $parent_item['link_path']) {
return $parent_item['link_path'];
}
--$depth;
}
}