You are here

function _dhtml_menu_menus in DHTML Menu 6.4

Same name and namespace in other branches
  1. 8 dhtml_menu.admin.inc \_dhtml_menu_menus()
  2. 7 dhtml_menu.admin.inc \_dhtml_menu_menus()

Build a human-readable option list for all non-empty menus. Custom menus and book menus are included if the respective modules are enabled.

1 call to _dhtml_menu_menus()
dhtml_menu_settings in ./dhtml_menu.admin.inc
Module settings form.

File

./dhtml_menu.admin.inc, line 137
dhtml_menu.admin.inc Functions that are only called on the admin pages.

Code

function _dhtml_menu_menus() {
  if (function_exists('menu_get_menus')) {

    // If the menu module is enabled, list custom menus.
    $menus = menu_get_menus();
  }
  else {

    // Otherwise, list only system menus.
    $menus = menu_list_system_menus();
  }

  // If the book module is enabled, also include book menus.
  if (function_exists('book_get_books')) {
    foreach (book_get_books() as $bid => $link) {
      $menus["book-toc-{$bid}"] = t('Book: %title', array(
        '%title' => $link['title'],
      ));
    }
  }

  // menu_get_names() filters out empty menus, and adds any menus not found using the above calls (edge case).
  foreach (menu_get_names() as $menu) {
    $menu_names[$menu] = isset($menus[$menu]) ? $menus[$menu] : t('Other menu: %menu', array(
      '%menu' => $menu,
    ));
  }
  return $menu_names;
}