You are here

function _advanced_menu_submenu_menus in Advanced Menu 7

Helper function to determine what menus can be linked to from a given menu.

1 call to _advanced_menu_submenu_menus()
advanced_menu_submenu_form_alter in submenu/advanced_menu_submenu.module
Implementation of hook_form_alter().

File

submenu/advanced_menu_submenu.module, line 277
Provides advanced menu submenus.

Code

function _advanced_menu_submenu_menus($menu, $default_value = NULL) {

  //Load available menus.
  if (module_exists('advanced_menu_menu_admin')) {
    $menus = _advanced_menu_menu_admin_menus();
  }
  else {
    $menus = menu_get_menus();
  }
  $exclude_menus = _advanced_menu_submenu_cycle($menu, $default_value);

  //Remove menus which would create a circular reference.
  foreach ($exclude_menus as $key => $value) {
    unset($menus[$value]);
  }
  if (empty($menus)) {
    drupal_set_message('No eligible sub menus were found.', 'warning');
  }
  return $menus;
}