You are here

function og_menu_get_menus in Organic Groups Menu (OG Menu) 7.3

Same name and namespace in other branches
  1. 6 og_menu.module \og_menu_get_menus()

Returns menus for a given gid and group_type in a structured array.

Parameters

$gid: The group id.

$group_type: The group type.

Return value

array A structured array with menus list.

1 call to og_menu_get_menus()
og_menu_menu_overview_form in ./og_menu.pages.inc
Form for displaying and re-ordering the og menus for a group.

File

./og_menu.module, line 1003
Integrates Menu with Organic Groups. Lots of menu forms duplication in OG context.

Code

function og_menu_get_menus($group_type, $gid) {

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