You are here

function menu_block_get_all_menus in Menu Block 7.3

Same name and namespace in other branches
  1. 6.2 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 An array of menu titles keyed by menu machine name.

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.
1 string reference to 'menu_block_get_all_menus'
menu_block_menu_link_insert in ./menu_block.module
Implements hook_menu_link_insert().

File

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

Code

function menu_block_get_all_menus() {
  $all_menus =& drupal_static(__FUNCTION__);
  if (!$all_menus) {
    $cid = 'menu_block_menus:' . $GLOBALS['language']->language;
    if ($cached = cache_get($cid, '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'));
      asort($all_menus);

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