Hi,
I think Nodehierarchy module is rapidly shaping up to be the all-you-need-module for working with hierarchical content in Drupal! Congrats to Ronan! The latest additions in the development version like automatic menu creation for normal users and the possibility to delete all children when deleting a node are really nice!
One thing that's still annoying me though (yes there's always something isn't it :) is that, when I change the title of a node and thus it's url alias, the children of that node still are still referred to by the old path.
For example I have the following node structure:
title url alias
My short node /my-short-node
Child 1 /my-short-node/child-1
Child 2 /my-short-node/child-2
Child 2.a /my-short-node/child-2/child 2.a
Now I change the title of My short node to My big node and I get:
title url alias
My big node /my-big-node
Child 1 /my-short-node/child-1
Child 2 /my-short-node/child-2
Child 2.a /my-short-node/child-2/child 2.a
While instead I would like to get:
title url alias
My big node /my-big-node
Child 1 /my-big-node/child-1
Child 2 /my-big-node/child-2
Child 2.a /my-big-node/child-2/child 2.a
Of course you can get the url aliases to rebuild by editing and saving all child nodes manually. But that's not really feasible if you got 100 child nodes :)
So here's the deal: I'm volunteering to work on this problem in the following days, because we really need that functionality (by next week no less :). But before I start, maybe someone (Ronan?) can give me some tips regarding this? Where would I have to begin? I hacked away a bit on this module before (I had developed my own hack for the 'automatic menu creation' thingy before it appeared on the forums here), so you can give me the big picture, no handholding needed :)
Of course, when it's done I'll post a patch here!
Greetings,
Hopla
Comments
Comment #1
ronan commentedThanks for pitching in. Off the top of my head, I can't think of anything that might help you out, but I'll be available if you have any questions as you get dug in. Ping me on my contact page and I'll send you my email/IM.
Thanks
Ronan
Comment #2
hopla commentedAllright, I managed to implement this as a seperate module in only a handfull lines of code, hooray :)
The module is called nodehierarchy_recursive_pathauto . It should be seen as a proof of concept. For actual implementation I think you should add this to the nodehierarchy module directly:
The last option looks best IMHO. What do you think Ronan?
Now for the actual code:
Comment #3
ronan commentedThat looks like a good solution, and I am in favor of the module approach as it keeps the main module a little cleaner (well, maybe clean is not the word, but I do plan on cleaning up the module at some point). It's little utilities like this that made me write the nodehierarchy api hook in the first place and it's nice to see someone else using it. I hesitate only because I need to balance between keeping nodehierarchy's codebase simple and potentially needing to enable dozens of modules just to get it to do something useful.
Tough balance to strike.
This'll likely make it into the next major release in some form though. Thanks for sharing it back.
Ronan
Comment #4
hopla commentedHi Ronan,
Yes, your foresight to develop an api and hook system certainly made this task a LOT easier :) I wish I had such experienced development skills!
If you can't come up with 'the best' solution right now, I suggest you implement it in whichever form anyway. Because, even though it's only a handful lines of code, it's a pretty valuable addition I think? And then you can always re-implement it in some other form later on(?).
Hopla
Comment #5
Jean-Philippe Fleury commentedHi,
I would like to know what's about integration of hopla's module?
Thanks.
Comment #6
hopla commentedHi luron,
I don't know when ronan is planning to integrate this, but you can easily include this yourself. Just create a new module 'nodehierarchy_recursive_pathauto' and copy the code as pasted above in the .module file.
We have been using this same code for months now, in production and so far it never failed :)
Of course it would be nice if this can be included officially, but if you need it here and now: it's pretty easy to do.
Comment #7
Jean-Philippe Fleury commentedThanks a lot, hopla. I'll create a module.
Comment #8
dgorton commentedI think the last option in #2 above is the best - moving nodehierarchy_token integration into it's own module. The 5.x write-your-own that hopla has will work for 5.x - but marking this as for fix-in-6.x consideration.
Comment #9
dgorton commentedAha - it looks like #811274: Recursive Pathauto for 6-x-2.x and "Add Children Only" is the port. Closing this issue - will follow up in the 6.x issue.