From 30c2ff330322a2866f3694f353723e512eda89ec Mon Sep 17 00:00:00 2001
From: Andrei Mateescu <andrei@xns.ro>
Date: Mon, 27 Jun 2011 12:47:43 +0300
Subject: [PATCH] Issue #1002054 by Boriss, alpritt and amateescu: Menu name change in D7 not ported to Nice Menus.

---
 README.txt        |    6 ++--
 nice_menus.module |   62 +++++++++++++++++-----------------------------------
 2 files changed, 23 insertions(+), 45 deletions(-)

diff --git a/README.txt b/README.txt
index 8d30f99..d757c48 100644
--- a/README.txt
+++ b/README.txt
@@ -113,7 +113,7 @@ Advanced theming
 ----------------
 If you're creating or modifying your own theme, you can integrate Nice menus more deeply by making use of these functions:
 theme_nice_menus() -- themes any menu tree as a Nice menu.
-theme_nice_menus_primary_links() -- themes your primary links as a Nice menu.
-theme_nice_menus_secondary_links() -- themes your secondary links as a Nice menu.
+theme_nice_menus_main_menu() -- themes your main menu as a Nice menu.
+theme_nice_menus_secondary_menu() -- themes your secondary menu as a Nice menu.
 
-If you really know what you're doing, you can probably even customize the menu tree in creative ways, as those functions allow you to pass in a custom menu tree.
\ No newline at end of file
+If you really know what you're doing, you can probably even customize the menu tree in creative ways, as those functions allow you to pass in a custom menu tree.
diff --git a/nice_menus.module b/nice_menus.module
index 52bd94d..b84c253 100644
--- a/nice_menus.module
+++ b/nice_menus.module
@@ -77,7 +77,6 @@ function nice_menus_menu() {
   return $items;
 }
 
-
 /**
  * Settings form as implemented by hook_menu
  */
@@ -280,28 +279,15 @@ function nice_menus_theme() {
     'nice_menus' => array(
       'variables' => array('id' => NULL, 'menu_name' => NULL, 'mlid' => NULL, 'direction' => 'right', 'depth' => -1, 'menu' => NULL),
     ),
-    'nice_menus_primary_links' => array(
-      'variables' => array('direction' => 'down', 'depth' => -1, 'menu' => NULL),
+    'nice_menus_main_menu' => array(
+      'variables' => array('direction' => 'down', 'depth' => -1),
     ),
-    'nice_menus_secondary_links' => array(
-      'variables' => array('direction' => 'down', 'depth' => -1, 'menu' => NULL),
+    'nice_menus_secondary_menu' => array(
+      'variables' => array('direction' => 'down', 'depth' => -1),
     ),
     'nice_menus_menu_item_link' => array(
       'variables' => array('element' => array()),
     ),
-    // Deprecated theme functions that will be removed in 7.x.
-    'nice_menu_tree' => array(
-      'variables' => array('menu_name' => NULL, 'mlid' => NULL, 'depth' => -1, 'menu' => NULL),
-    ),
-    'nice_menu_build' => array(
-      'variables' => array('menu' => NULL, 'depth' => -1, 'trail' => NULL),
-    ),
-    'nice_menu' => array(
-      'variables' => array('id' => NULL, 'menu_name' => NULL, 'mlid' => NULL, 'direction' => 'right', 'depth' => -1, 'menu' => NULL),
-    ),
-    'nice_menu_primary_links' => array(
-      'variables' => array('direction' => 'down', 'depth' => -1, 'menu' => NULL),
-    ),
   );
 }
 
@@ -310,6 +296,7 @@ function nice_menus_theme() {
  *
  * @param $page_menu
  *   The menu data for a page.
+ *
  * @return
  *   An array of parent menu item ids.
  */
@@ -331,7 +318,7 @@ function nice_menus_build_page_trail($page_menu) {
  *
  * @param $menu_name
  *   The top-level menu name that contains the menu to use (e.g. navigation
- *   or primary-links) for Drupal menus. For custom $menus this is just the
+ *   or main-menu) for Drupal menus. For custom $menus this is just the
  *   name for menu display.
  * @param $mlid
  *   The menu ID from which to start building the items, i.e. the parent
@@ -342,6 +329,7 @@ function nice_menus_build_page_trail($page_menu) {
  * @param $menu
  *   Optional. A custom menu array to use for theming -- it should have
  *   the same structure as that returned by menu_tree_all_data().
+ *
  * @return
  *   An HTML string of properly nested Nice menu lists.
  */
@@ -510,6 +498,7 @@ function theme_nice_menus_build($variables) {
  *   Optional. A custom menu array to use for theming --
  *   it should have the same structure as that returned
  *  by menu_tree_all_data(). Default is the standard menu tree.
+ *
  * @return
  *   An HTML string of Nice menu links.
  */
@@ -531,55 +520,45 @@ function theme_nice_menus($variables) {
 }
 
 /**
- * Theme primary links as Nice menus.
+ * Theme the main menu as a Nice menu.
  *
  * @param $direction
  *   Optional. The direction the menu expands. Default is 'down'.
  * @param $depth
  *   The number of children levels to display. Use -1 to display all children
  *   and use 0 to display no children.
- * @param $menu
- *   Optional. A custom menu array to use for theming --
- *   it should have the same structure as that returned
- *   by menu_tree_all_data(). Default is the standard menu tree.
+ *
  * @return
- *   An HTML string of Nice menu primary links.
+ *   An HTML string of Nice main menu links.
  */
-function theme_nice_menus_primary_links($variables) {
+function theme_nice_menus_main_menu($variables) {
   $direction = $variables['direction'];
   $depth = $variables['depth'];
-  $menu = $variables['menu'];
-  $menu_name = variable_get('menu_primary_links_source', 'primary-links');
-  $output = theme('nice_menus', array('id' => 0, 'menu_name' => $menu_name, 'mlid' => 0, 'direction' => $direction, 'depth' => $depth, 'menu' => $menu));
+  $menu_name = variable_get('menu_main_links_source', 'main-menu');
+  $output = theme('nice_menus', array('id' => 0, 'menu_name' => $menu_name, 'mlid' => 0, 'direction' => $direction, 'depth' => $depth));
   return $output['content'];
 }
 
 /**
- * Theme secondary links as nice menus.
+ * Theme the secondary menu as a Nice menu.
  *
  * @param $direction
  *   Optional. The direction the menu expands. Default is 'down'.
  * @param $depth
  *   The number of children levels to display. Use -1 to display all children
  *   and use 0 to display no children.
- * @param $menu
- *   Optional. A custom menu array to use for theming --
- *   it should have the same structure as that returned
- *   by menu_tree_all_data(). Default is the standard menu tree.
+ *
  * @return
- *   An HTML string of nice menu secondary links.
+ *   An HTML string of Nice secondary menu links.
  */
-function theme_nice_menus_secondary_links($variables) {
+function theme_nice_menus_secondary_menu($variables) {
   $direction = $variables['direction'];
   $depth = $variables['depth'];
-  $menu = $variables['menu'];
-  $menu_name = variable_get('menu_secondary_links_source', 'secondary-links');
-  $output = theme('nice_menus', array('id' => 0, 'menu_name' => $menu_name, 'mlid' => 0, 'direction' => $direction, 'depth' => $depth, 'menu' => $menu));
+  $menu_name = variable_get('menu_secondary_links_source', 'user-menu');
+  $output = theme('nice_menus', array('id' => 0, 'menu_name' => $menu_name, 'mlid' => 0, 'direction' => $direction, 'depth' => $depth));
   return $output['content'];
 }
 
-
-
 /**
  * Generate the HTML output for a single menu link.
  *
@@ -591,4 +570,3 @@ function theme_nice_menus_menu_item_link($variables) {
   }
   return l($variables['element']['#title'], $variables['element']['#href'], $variables['element']['#localized_options']);
 }
-
-- 
1.7.4.msysgit.0

