function _gc_get_menu_by_gc_id in GatherContent 8
Same name and namespace in other branches
- 8.3 gathercontent.module \_gc_get_menu_by_gc_id()
Parameters
$mlid:
$menu_name:
1 call to _gc_get_menu_by_gc_id()
File
- ./
gathercontent.module, line 364 - Main module file for GatherContent module.
Code
function _gc_get_menu_by_gc_id(&$mlid, &$menu_name, $language = NULL) {
// Load node by gc_id.
$query = new EntityFieldQuery();
$node_result = $query
->entityCondition('entity_type', 'node')
->propertyCondition('gc_id', $mlid)
->execute();
if (isset($node_result['node'])) {
// Load menu_link by node_id.
$nodes = reset(array_keys($node_result['node']));
$ml_result = $query
->entityCondition('entity_type', 'menu_link')
->propertyCondition('link_path', 'node/' . $nodes);
if (!is_null($language)) {
$ml_result
->propertyCondition('language', $language);
}
$ml_result
->execute();
if (isset($ml_result['menu_link'])) {
$ml = reset(array_keys($ml_result['menu_link']));
$ml_object = menu_link_load($ml);
$menu_name = $ml_object['menu_name'];
$mlid = $ml_object['mlid'];
}
}
}