? menu_00.patch Index: taxonomy_breadcrumb.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/taxonomy_breadcrumb/taxonomy_breadcrumb.inc,v retrieving revision 1.1.2.3 diff -u -p -r1.1.2.3 taxonomy_breadcrumb.inc --- taxonomy_breadcrumb.inc 31 May 2009 19:37:18 -0000 1.1.2.3 +++ taxonomy_breadcrumb.inc 6 Jun 2009 22:24:39 -0000 @@ -7,41 +7,34 @@ */ /** - * This function overrides the core taxonomy_term_page. First, call the core - * taxonomy_term_page. Then, alter the breadcrumb trail. This module's - * hook_menu and a module weight greater than taxonomy's ensure this - * function gets called for the taxonomy/term path (the module weight is - * in the system table and is set in taxonomy_breadcrumb.install). - */ -function _taxonomy_breadcrumb_term_page($str_tids = '', $depth = 0, $op = 'page') { - static $callback = array(); - if (empty($callback)) { - $callback = variable_get('taxonomy_breadcrumb_override_callback', array() ); - if (!empty($callback)) { - $require_path = isset($callback['file path']) ? $callback['file path'] : drupal_get_path('module', $callback['module']); - require_once($require_path .'/'. $callback['file']); - } - else { - // Default to core taxonomy_term_page callback. - // Include the .inc file with all helper functions. - require_once(drupal_get_path('module', 'taxonomy') .'/taxonomy.pages.inc'); - } - } - if (isset($callback['page callback'])) { - $func = $callback['page callback']; - // Assume that any function overriding the core taxonomy function would have the same parameters. - $output = $func($str_tids, $depth, $op); - } - else { - // Call the core taxonomy_term_page function. - $output = taxonomy_term_page($str_tids, $depth, $op); - } + * Set a Taxonomy breadcrumb and call the original taxonomy/term/% callback. + * + * @param $callback + * A callback function as defined in hook_menu(). + * @param $file + * A callback file as defined in hook_menu(). + * @param $filepath + * A callback file path as defined in hook_menu(). + * @param ... + * Additional arguments to pass on to the callback. + * + * @ return + * The return value of the original callback function. + */ +function _taxonomy_breadcrumb_term_page() { + $args = func_get_args(); + $callback = array_shift($args); + $file = array_shift($args); + $filepath = array_shift($args); // Use first term to generate breadcrumb trail. - $terms = taxonomy_terms_parse_string($str_tids); + $terms = taxonomy_terms_parse_string($args[0]); $breadcrumb = _taxonomy_breadcrumb_generate_breadcrumb($terms['tids'][0], TRUE); drupal_set_breadcrumb($breadcrumb); - return $output; + + require_once($filepath .'/'. $file); + + return call_user_func_array($callback, $args); } /** Index: taxonomy_breadcrumb.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/taxonomy_breadcrumb/taxonomy_breadcrumb.module,v retrieving revision 1.7.2.2 diff -u -p -r1.7.2.2 taxonomy_breadcrumb.module --- taxonomy_breadcrumb.module 24 Apr 2009 02:51:41 -0000 1.7.2.2 +++ taxonomy_breadcrumb.module 6 Jun 2009 22:24:40 -0000 @@ -90,12 +90,17 @@ function taxonomy_breadcrumb_nodeapi(&$n * Implementation of hook_menu_alter(). */ function taxonomy_breadcrumb_menu_alter(&$callbacks) { - // Defined by taxonomy, but might be modified by another module. - $existing_callback = $callbacks['taxonomy/term/%']; - variable_set('taxonomy_breadcrumb_override_callback', $existing_callback); - $callbacks['taxonomy/term/%']['page callback'] = '_taxonomy_breadcrumb_term_page'; - $callbacks['taxonomy/term/%']['file'] = 'taxonomy_breadcrumb.inc'; - $callbacks['taxonomy/term/%']['file path'] = drupal_get_path('module', 'taxonomy_breadcrumb'); + $term_callback = &$callbacks['taxonomy/term/%']; + + $callback = $term_callback['page callback']; + $arguments = $term_callback['page arguments']; + $file = $term_callback['file']; + $filepath = $term_callback['file path'] + + $term_callback['page callback'] = '_taxonomy_breadcrumb_term_page'; + $term_callback['page arguments'] = array_merge(array($callback, $file, $filepath), $arguments); + $term_callback['file'] = 'taxonomy_breadcrumb.inc'; + $term_callback['file path'] = drupal_get_path('module', 'taxonomy_breadcrumb'); } /**