function og_menu_get_group_menus in Organic Groups Menu (OG Menu) 7.2
Same name and namespace in other branches
- 6.2 og_menu.module \og_menu_get_group_menus()
- 7.3 og_menu.module \og_menu_get_group_menus()
Returns acessible menus for a given user or gids in a structured array.
Parameters
gids: An optional array of group gids.
user: An optional array of the user object.
Return value
A structured array with menus list.
7 calls to og_menu_get_group_menus()
- og_menu_block_view in ./
og_menu.module - Implementation of hook_block_view()
- og_menu_edit_item_form in ./
og_menu.pages.inc - Form callback; Build the menu link editing form.
- og_menu_form_node_form_alter in ./
og_menu.module - Implements hook_form_FORMID_alter().
- og_menu_node_form_validate in ./
og_menu.module - Validation handler for OG group node forms. We will only end up here if we have confirmed that the node is a group type content
- og_menu_node_prepare in ./
og_menu.module - Implementation of hook_node_prepare().
File
- ./
og_menu.module, line 732 - Integrates Menu with Organic Groups. Lots of menu forms duplication in OG context.
Code
function og_menu_get_group_menus($gids = NULL, $user = NULL) {
if (!$user) {
global $user;
}
if (!$gids) {
$nodegroups = og_load_multiple(og_get_entity_groups('user', $user));
foreach ($nodegroups as $ng) {
$gids[] = $ng->gid;
}
}
$menus = array();
if ($gids) {
// @todo Convert this query to use db_select().
$result = db_query("SELECT\n om.gid,\n om.menu_name as omname,\n m.menu_name as mname,\n m.title as mtitle\n FROM {og_menu} om\n LEFT JOIN {menu_custom} m ON om.menu_name = m.menu_name\n WHERE om.gid IN (:gids)\n ORDER BY mtitle", array(
':gids' => $gids,
));
foreach ($result as $menu) {
$menus[] = $menu;
}
}
return $menus;
}