public function PowerMenuNodeHandler::getMenuPathToActivate in Power Menu 7.2
Overrides PowerMenuHandlerInterface::getMenuPathToActivate
See also
PowerMenuHandlerInterface::getMenuPathToActivate()
File
- plugins/
menu_handlers/ PowerMenuNodeHandler.class.php, line 35
Class
- PowerMenuNodeHandler
- Implementation of the interface PowerMenuHandlerInterface.
Code
public function getMenuPathToActivate($entity, $type, array $router_item, $alias) {
$path = NULL;
$bundles = variable_get('power_menu_node_bundles', array());
$info = entity_get_info($type);
// Get the bundle name from the entity. Does no bundle exists use type
$bundle = isset($entity->{$info}['entity keys']['bundle']) ? $entity->{$info}['entity keys']['bundle'] : $type;
$key = $type . '|' . $bundle;
// Is a menu link defined for given bundle key return it.
if (!empty($bundles[$key])) {
$path = $bundles[$key]['link_path'];
}
return $path;
}