? patches
Index: menu_breadcrumb.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/menu_breadcrumb/menu_breadcrumb.module,v
retrieving revision 1.7
diff -r1.7 menu_breadcrumb.module
53a54,135
>  * Get the menu selection configuration.
>  *
>  * @return
>  *   The menu selection/weight array.
>  */
> function _menu_breadcrumb_get_menus() {
>   static $menus;
> 
>   if (!isset($menus)) {
>     // The default selections, if we have yet to configure the module.
>     $default_menus = array(
>       'primary-links'    => array(
>                               'weight' => -3,
>                               'selected' => TRUE,
>                             ),
>       'secondary-links'  => array(
>                               'weight' => -2,
>                               'selected' => TRUE,
>                             ),
>       'navigation'       => array(
>                               'weight' => -1,
>                               'selected' => TRUE
>                             ),
>       'admin_menu'       => array('selected' => FALSE),
>       'devel'            => array('selected' => FALSE),
>     );
>     // Fetch stored settings, and merge in any previously-unknown menus
>     $menus = variable_get('menu_breadcrumb_menus', $default_menus);
>     foreach (menu_get_names() as $menu_name) {
>       if (!array_key_exists($menu_name, $menus)) {
>         $menus[$menu_name] = array('selected' => TRUE, 'weight' => 0);
>       }
>     }
>     uasort($menus, '_menu_breadcrumb_sort'); // sort by weight
>   }
>   return $menus;
> }
> 
> 
> /**
>  * Sort-by-weight comparison.
>  */
> function _menu_breadcrumb_sort($menu1, $menu2) {
>   $menu1_weight = !empty($menu1['weight']) ? $menu1['weight'] : 0;
>   $menu2_weight = !empty($menu2['weight']) ? $menu2['weight'] : 0;
>   if ($menu1_weight == $menu2_weight) {
>     return 0;
>   }
>   return ($menu1_weight < $menu2_weight) ? -1 : 1;
> }
> 
> 
> /**
>  * Get the menu/selection list.
>  *
>  * @return
>  *   An array indicating the selection status of each menu.
>  */
> function menu_breadcrumb_menu_list() {
>   static $list;
> 
>   if (!isset($list)) {
>     $menus = _menu_breadcrumb_get_menus();
> 
>     $list = array();
>     foreach ($menus as $name => $menu) {
>       $list[$name] = (bool) $menu['selected'];
>     }
> 
>     // Enable other modules to dynamically modify the menu list
>     // (for example, to make the order depend upon the current
>     // user's language preference)
>     if ($hook = module_invoke_all('menu_breadcrumb_menu_list', $list)) {
>       $list = $hook;
>     }
>   }
> 
>   return $list;
> }
> 
> 
> /**
54a137,138
>  * 
>  * Set the active menu according to the current path.
58,59c142,143
<     $menu_list = variable_get('menu_breadcrumb_menus', array('admin_menu', 'devel'));
<     $filter = variable_get('menu_breadcrumb_menus_filter', 'blacklist');
---
>     $menu_list = menu_breadcrumb_menu_list();
>     $filter = variable_get('menu_breadcrumb_menus_filter', 'whitelist');
61a146
>     $menus = array();
63,67c148,156
<       // @see http://www.php.net/manual/en/function.in-array.php#86695
<       $menu_in_list = in_array($menu_link['menu_name'], $menu_list, TRUE);
<       if ( ( $filter == 'whitelist' && $menu_in_list ) ||
<            ( $filter == 'blacklist' && !$menu_in_list ) ) {
<         menu_set_active_menu_name($menu_link['menu_name']);
---
>       $menus[$menu_link['menu_name']] = TRUE;
>     }
> 
>     foreach ($menu_list as $menu_name => $selected) {
>       $filter_match = ( ($filter == 'whitelist' && $selected)
>                      || ($filter == 'blacklist' && !$selected) );
> 
>       if ($filter_match && array_key_exists($menu_name, $menus)) {
>         menu_set_active_menu_name($menu_name);
95c184
<  * The settings form used by Menu breadcrumb.
---
>  *   The settings form used by Menu breadcrumb.
97a187,188
>   $form['#submit'][] = 'menu_breadcrumb_admin_settings_form_submit';
> 
126c217
<   $include_exclude_description = 'Use this to specify which menus are used to generate breadcrumbs. ' ;
---
>   $include_exclude_description = 'Check the menus you wish to select breadcrumbs from. Drag or adjust weights to determine the order of menus to use.' ;
133,142c224
<   $form['include_exclude']['menu_breadcrumb_menus_filter'] = array(
<     '#type' => 'radios',
<     '#title' => t('Menu filter'),
<     '#options' => array(
<       'blacklist' => t('Blacklist - Menu items will never be chosen from the menus selected below.'),
<       'whitelist' => t('Whitelist - Menu items will only be chosen from the menus selected below.'),
<     ),
<     '#default_value' => variable_get('menu_breadcrumb_menus_filter', 'blacklist'),
<   );
< 
---
>   // Orderable list of menu selections
144,148c226,227
<     '#type' => 'checkboxes',
<     '#title' => t('Menu list'),
<     '#description' => t('Select which menus to apply the blacklist / whitelist to.'),
<     '#options' => drupal_map_assoc(menu_get_names()),
<     '#default_value' => variable_get('menu_breadcrumb_menus', array('admin_menu', 'devel')),
---
>     '#tree' => TRUE,
>     '#theme' => 'menu_breadcrumb_menus_table',
150a230,247
>   $menus = _menu_breadcrumb_get_menus();
>   $weight_delta = count($menus);
> 
>   foreach ($menus as $menu_name => $menu) {
>     $form['include_exclude']['menu_breadcrumb_menus'][$menu_name] = array(
>       'selected' => array(
>         '#type' => 'checkbox',
>         '#title' => $menu_name,
>         '#default_value' => $menu['selected'],
>       ),
>       'weight' => array(
>         '#type' => 'weight',
>         '#default_value' => !empty($menu['weight']) ? (int) $menu['weight'] : 0,
>         '#delta' => $weight_delta,
>       ),
>     );
>   }
> 
151a249,288
> }
> 
> 
> /**
>  * Implementation of hook_theme().
>  */
> function menu_breadcrumb_theme() {
>   return array(
>     'menu_breadcrumb_menus_table' => array(
>       'arguments' => array('element' => NULL),
>     ),
>   );
> }
> 
> /**
>  * Theme a drag-to-reorder table of menu selection checkboxes.
>  */
> function theme_menu_breadcrumb_menus_table($element) {
>   drupal_add_tabledrag('menu-breadcrumb-menus', 'order', 'sibling', 'menu-weight');
> 
>   $header = array(
>     t('Menus to use for breadcrumbs:'),
>     t('Weight:'),
>   );
> 
>   // Generate table of draggable menu names
>   $rows = array();
>   foreach (element_children($element) as $menu) {
>     ++$element[$menu]['weight']['#value'];
>     $element[$menu]['weight']['#attributes']['class'] = 'menu-weight';
>     $row = array();
>     $row[] = drupal_render($element[$menu]['selected']);
>     $row[] = drupal_render($element[$menu]['weight']);
>     $rows[] = array(
>       'data' => $row,
>       'class' => 'draggable',
>     );
>   }
> 
>   return theme('table', $header, $rows, array('id' => 'menu-breadcrumb-menus'));
