function _menu_trail_by_path_get_parent_candidates in Menu Trail By Path 7.2
Returns an array of parent candidates
e.g. given the argument 'foo/bar/zee', this returns an array of internal Drupal paths for 'foo', 'foo/bar', 'foo/bar/zee'.
Parameters
string $path: A Drupal path alias.
Return value
array An array of internal Drupal paths.
1 call to _menu_trail_by_path_get_parent_candidates()
File
- ./
menu_trail_by_path.module, line 131 - Expand menu items and set active-trail according to current path.
Code
function _menu_trail_by_path_get_parent_candidates($path) {
$pieces = explode('/', $path);
$path = '';
$parent_candidates = array();
foreach ($pieces as $piece) {
$path .= $piece . '/';
$parent_candidates[] = drupal_get_normal_path(rtrim($path, '/'));
}
// Allow other modules to alter the parent candidates.
drupal_alter('menu_trail_by_path_parent_candidates', $path, $parent_candidates);
return $parent_candidates;
}