Using this module breaks Taxonomy breadcrumbs
andyscotuk - June 21, 2009 - 14:21
| Project: | Taxonomy Manager |
| Version: | 6.x-1.1 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
I installed this module and thought it was great for adding multiple terms to categories. However when I used Taxonomy Breadcrumb any terms created with this module did not display properly. Terms that are added in to the taxonomy by hand through the drupal interface work fine in Taxonomy Breadcrumb. This leads me to believe that your code is doing something different when adding terms to adding terms by hand and therefore the module is no good to me. Hope this helps - let me know if you need further information

#1
#2
further analysis of this showed that maybe I misunderstood the taxonomy action. I thought I had a taxonomy where each menu item had to have one parent only. In version 5 of Drupal I am sure this was an option. It appears that the Taxonomy in version 6 allows multiple parents which then causes an issue when using modules such "taxonomy breadcrumbs"
#3
I believe that in fact Taxonomy Manager does break Taxonomy Breadcrumbs. But also many other modules like Taxonomy Breadcrumbs break other modules that use hook_menu_alter to register their callback for 'taxonomy/term/%'.
Unfortunatly in D6 a specific menu callback can only be registered to one callback function. So proper behaviour would be for Taxonomy Manager (and for all other modules that use that hook to divert a menu item from core) to first save the old callback, then set its own callback and finally call the old callback after its own callback function is finished.
I am not able to roll patches (yet), but I have some code from a custom module that I wrote to change the taxonomy default depth to unlimited that does the trick. Feel free to C&P.
<?php
function mymodule_menu_alter(&$items) {
// save old callback so we can call it later to chain calls
$old_item = $items['taxonomy/term/%'];
variable_set('mymodule_oldcallback', $old_item);
// set new callback
$items['taxonomy/term/%'] = array(
'title' => 'Taxonomy term',
'page callback' => '_mymodule_term_page',
'page arguments' => array(2),
'access callback' => 'user_access',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
}
function _mymodule_term_page($str_tids = '', $depth = NULL, $op = 'page') {
// load former callback
$old_callback = variable_get('mymodule_oldcallback', false);
// do something
// If the former callback is still there
if($old_callback && file_exists(drupal_get_path('module', $old_callback['module']) . '/' . $old_callback['file'])) {
// load it and call it
require_once drupal_get_path('module', $old_callback['module']) . '/' . $old_callback['file'];
return call_user_func_array($old_callback['page callback'], array($str_tids, $depth, $op));
} else {
// otherwise load code from core and call it
require_once drupal_get_path('module', 'taxonomy') .'/taxonomy.pages.inc';
return taxonomy_term_page($str_tids, $depth, $op);
}
}
?>
It seeems that Drupal rebuilds the menu callbacks every time a module is activated or deactivated. So if all modules would adapt that behaviour above, everything should be fine until D7, where I believe there are some changes in the menu system that might make that workaround obsolete. HTH.
#4
I added an option to disable the overwriting of the taxonomy/term/% path in Taxonomy Manager,
see #469126: incompatibiliy with panel3 beta2 by providing a taxonomy/term/% for more info
#5
Automatically closed -- issue fixed for 2 weeks with no activity.