3

I want to batch override (there are hundreds of terms) menu paths generated by the Taxonomy Menu module for a custom menu I require. I know not to edit the module itself. I assume I create a separate module containing the replacement function to substitute the desired path I want, but I am not certain how to direct Drupal to use it instead of the original. Or am I using the wrong strategy for this?

UPDATE: I have solved the specific example in the question using a panel tied to a view. However, I am still interested in the question itself. A theme function can be overridden by including the replacement function with my theme name replacing the original theme name in the function name. Drupal handles the substitution from there; the same renaming option is not available for module functions.

I have continued to research this and found several posts at Drupal.org, that suggests it is not possible to override module functions in the same way you override theme functions. There was a module for this in Drupal 6 (Override_Function), but it required additional software and appeared to have some problems working with PHP 5.2 & 5.3. The only workaround I have found so far is to hack it, but keep track of your changes so that it can be reinserted after updates.

4

It sounds more like you want to use hook_menu_alter to override what the Taxonomy Menu module's hook_menu function does.

4
  • I don't think so. I do not want to remove an item from the menu tree, I want to change the path the menu item calls when it is selected. Taxonomy or Taxonomy Menu does not allow altering the path through the UI. I want the menu item to go to a view rather than a taxonomy term. I only want to override a single function in the Taxonomy Edit module to create this specialized menu and then turn off my custom code.
    – Ashlar
    Nov 3 '11 at 17:12
  • 2
    hook_menu_alter is what you want. You can change the 'page callback' and that will change the path to which it goes. You'll also save yourself the maintenance headache come upgrade time. Nov 10 '11 at 2:41
  • wizonesolutions. I agree with you and actually solved my problem using a panel redirect. In the meantime I have also been exploring modules and have a situation unrelated to the menu example that requires a modification to a function in a module. I forgot the specific example in the question and simply addressed the question itself. IF you know of a way to override a function I'd love to hear it. I modified the answer I gave to make that a bit clearer for anyone who reads this question.
    – Ashlar
    Nov 10 '11 at 4:13
  • 1
    +1 I was doing some housekeeping on older questions and missed crediting your answer. Thanks for helping.
    – Ashlar
    Feb 1 '12 at 4:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.