Skip to content
Josh edited this page Sep 2, 2015 · 2 revisions

The main menu for Kalatheme is set to load only two levels deep via this code in kalatheme_process_page():

  // Get the menu tree for the menu that is set as 'Source for the Main links'.
  $main_links_menu = variable_get('menu_main_links_source', 'main-menu');
  $main_menu_tree = menu_tree_all_data($main_links_menu, NULL, 2);

This is suitable for most people however in some specific cases it may be useful to extend this.

In order to do this in your sub theme implement hook_process_page() like so:

  /**
   * Implements hook_preprocess_page.
   */
  function *your_theme_name*_process_page(&$vars){
    // Make our menu deeper.
    $depth = 4;
    $main_links_menu = variable_get('menu_main_links_source', 'main-menu');
    $main_menu_tree = menu_tree_all_data($main_links_menu, NULL, $depth);
  }

Just change $depth to the depth you require and voila!