? nice_menus-depth-135771-19.patch ? nice_menus-depth-135771-22.patch Index: nice_menus.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/nice_menus/nice_menus.module,v retrieving revision 1.16.2.16 diff -u -p -r1.16.2.16 nice_menus.module --- nice_menus.module 9 Feb 2008 17:36:20 -0000 1.16.2.16 +++ nice_menus.module 20 Mar 2008 01:00:54 -0000 @@ -149,6 +149,13 @@ function nice_menus_block($op = 'list', '#default_value' => variable_get('nice_menus_type_'. $delta, 'right'), '#options' => drupal_map_assoc(array('right', 'left', 'down')), ); + $form['nice_menus_depth_'. $delta] = array( + '#type' => 'select', + '#title' => t('Maximum Depth'), + '#description' => t('the depth of the menu, starting with the parent selected above to be displayed. this allows primary/secondary links functionality. if unsure, just leave this at -1 which will show all items.'), + '#default_value' => variable_get('nice_menus_depth_'. $delta, -1), + '#options' => drupal_map_assoc(range(-1,5)) + ); return $form; break; @@ -156,13 +163,15 @@ function nice_menus_block($op = 'list', variable_set('nice_menus_name_'. $delta, $edit['nice_menus_name_'. $delta]); variable_set('nice_menus_menu_'. $delta, $edit['nice_menus_menu_'. $delta]); variable_set('nice_menus_type_'. $delta, $edit['nice_menus_type_'. $delta]); + variable_set('nice_menus_depth_'. $delta, $edit['nice_menus_depth_'.$delta]); break; case 'view': // Build the nice menu for the block. $pid = variable_get('nice_menus_menu_'. $delta, '1'); $direction = variable_get('nice_menus_type_'. $delta, 'right'); - if ($output = theme('nice_menu', $delta, $pid, $direction)) { + $depth = variable_get('nice_menus_depth_'.$delta, '-1'); + if ($output = theme('nice_menu', $delta, $depth, $pid, $direction)) { $block['content'] = $output['content']; if (variable_get('nice_menus_type_'. $delta, 'right') == 'down') { $class = 'nice-menu-hide-title'; @@ -200,7 +209,7 @@ function nice_menus_block($op = 'list', * @return * An HTML string of properly nested nice menu lists. */ -function theme_nice_menu_tree($pid = 1, $menu = NULL) { +function theme_nice_menu_tree($pid = 1, $depth = -1, $deep = 0, $menu = NULL) { $menu = isset($menu) ? $menu : menu_get_menu(); $output['content'] = ''; @@ -215,13 +224,15 @@ function theme_nice_menu_tree($pid = 1, // Convert slashes to dashes $clean_path = str_replace('/', '-', $clean_path); $path_class = 'menu-path-'. $clean_path; - if (count($menu['visible'][$mid]['children']) > 0) { - $output['content'] .= '\n"; + if (count($menu['visible'][$mid]['children']) > 0 && $depth != 0) { + if ($deep < $depth || $depth == -1) { + $output['content'] .= '\n"; + } } else { $output['content'] .= ''."\n"; @@ -248,10 +259,10 @@ function theme_nice_menu_tree($pid = 1, * @return * An HTML string of nice menu links. */ -function theme_nice_menu($id, $pid, $direction = 'right', $menu = NULL) { +function theme_nice_menu($id, $depth = -1, $pid, $direction = 'right', $menu = NULL) { $output = array(); - if ($menu_tree = theme('nice_menu_tree', $pid, $menu)) { + if ($menu_tree = theme('nice_menu_tree', $pid, $depth, $menu)) { if ($menu_tree['content']) { $output['content'] = ''."\n"; $output['subject'] = $menu_tree['subject'];