function power_menu_set_path in Power Menu 7.2
Sets the system path to use for the active menu trail.
Parameters
$entity: The entity
$type: The entity type
$langcode: The language code
Return value
The system path
2 calls to power_menu_set_path()
- power_menu_entity_view in ./
power_menu.module - Implements hook_entity_view().
- power_menu_views_pre_render in includes/
views.inc
File
- ./
power_menu.module, line 230
Code
function power_menu_set_path($entity, $type, $langcode) {
// TODO: Implement cache_clear when forms submitted!
$path = power_menu_get_path($entity, $type);
// Is the path set to <front>, do only activate the item
if ($path == '<front>') {
$path = variable_get('site_frontpage', 'node');
menu_set_active_item($path);
}
elseif (preg_match('/^<[A-Za-z0-9]*>$/', $path)) {
// Do not set a path on special menu items like <nolink> ...
// This items mostly used on multiple menu-items and in this case
// Power Menu could/would activate the wrong.
}
else {
// Set the path for evey selected menu in the power_menu settings
foreach (variable_get('power_menu_handlers_menus', array()) as $menu_name) {
// The official way to set the active path
menu_tree_set_path($menu_name, $path);
}
// TODO: Cache the breadcrumbs
// Set the breadcrumb when is activated in settings and a path is set
if (variable_get('power_menu_handlers_breadcrumb', TRUE) && isset($path)) {
$breadcrumbs = power_menu_get_breadcrumbs($path);
// Add title only a title filed exists
if (variable_get('power_menu_handlers_breadcrumb_title', FALSE) && !empty($entity->title)) {
$breadcrumbs[] = $entity->title;
}
drupal_set_breadcrumb($breadcrumbs);
}
}
return $path;
}