You are here

function menu_block_get_all_menus in Menu Block 6.2

Same name and namespace in other branches
  1. 7.3 menu_block.module \menu_block_get_all_menus()
  2. 7.2 menu_block.module \menu_block_get_all_menus()

Returns a list of menu names implemented by all modules.

Return value

array A list of menu names and titles.

5 calls to menu_block_get_all_menus()
menu_block_configure_form in ./menu_block.admin.inc
Returns the configuration form for a menu tree.
menu_block_menu_tree_content_type_content_types in plugins/content_types/menu_tree/menu_tree.inc
Supplies a list of menu tree content sub-types.
menu_block_menu_tree_content_type_edit_form in plugins/content_types/menu_tree/menu_tree.inc
'Edit form' callback for the content type.
menu_tree_build in ./menu_block.module
Build a menu tree based on the provided configuration.
_menu_block_format_title in ./menu_block.admin.inc
Return the title of the block.

File

./menu_block.module, line 125
Provides configurable blocks of menu items.

Code

function menu_block_get_all_menus() {
  static $all_menus;
  if (!$all_menus) {
    if ($cached = cache_get('menu_block_menus', 'cache_menu')) {
      $all_menus = $cached->data;
    }
    else {

      // Retrieve core's menus.
      $all_menus = menu_get_menus();

      // Retrieve all the menu names provided by hook_menu_block_get_menus().
      $all_menus = array_merge($all_menus, module_invoke_all('menu_block_get_menus'));

      // Add an option to use the menu for the active menu item.
      $all_menus[MENU_TREE__CURRENT_PAGE_MENU] = '<' . t('the menu selected by the page') . '>';
      asort($all_menus);
      cache_set('menu_block_menus', $all_menus, 'cache_menu');
    }
  }
  return $all_menus;
}