function og_menu_single_get_link_mlid in OG Menu Single 7
Fetches the link for given item in menu.
Parameters
$type: What type of group it is -- currently only node is supported.
$id: ID of group.
$reset: Reset the internal cache for this $type/id.
Return value
A menu link in og menu single menu for given entity if exists.
4 calls to og_menu_single_get_link_mlid()
- og_menu_singleMenuItemNodeCreateTest::testMenuLinkCreated in tests/
og_menu_singleBase.test - Test skipping OgBehaviorHandler.
- og_menu_single_get_link_mlid_or_create in ./
og_menu_single.module - Fetched or crate space mlid of an entity.
- og_menu_single_node_prepare in ./
og_menu_single.module - Implements hook_node_prepare().
- og_menu_single_node_update in ./
og_menu_single.module - Implements hook_node_update().
File
- ./
og_menu_single.module, line 410 - Creates a single menu per organic group on a site.
Code
function og_menu_single_get_link_mlid($type, $id, $reset = FALSE) {
$mlids =& drupal_static(__FUNCTION__, array());
$cid = $type . '_' . $id;
if ($reset || !isset($mlids[$cid])) {
$mlids[$cid] = db_select('menu_links', 'ml')
->fields('ml', array(
'mlid',
))
->orderBy('mlid', 'ASC')
->condition('ml.link_path', 'node/' . $id)
->condition('ml.module', 'menu')
->condition('ml.menu_name', OG_MENU_SINGLE_MENU_NAME)
->range(0, 1)
->execute()
->fetchField();
}
return $mlids[$cid];
}