You are here

function groupmenu_get_menus in Group Menu 7

Returns menus for a given gid in a structured array.

Parameters

int $gid: The group id.

Return value

array A structured array with menus list.

2 calls to groupmenu_get_menus()
groupmenu_group_admin_block_alter in ./groupmenu.module
Implements hook_group_admin_block_alter().
groupmenu_overview_page in ./groupmenu.pages.inc
Menu callback to list the menus for the group.

File

./groupmenu.module, line 581
Integrates menu with Group.

Code

function groupmenu_get_menus($gid) {

  // If function arguments are empty, return.
  if (empty($gid)) {
    return array();
  }
  $q = db_select('group_menu', 'gm');
  $q
    ->join('menu_custom', 'm', 'gm.menu_name = m.menu_name');
  return $q
    ->fields('gm', array(
    'gid',
    'menu_name',
  ))
    ->fields('m', array(
    'title',
    'description',
  ))
    ->condition('gm.gid', $gid)
    ->orderBy('m.title')
    ->execute()
    ->fetchAllAssoc('menu_name');
}