Hi,
it would be nice if a cloned node would get a "clone of
" menu entry that was below the same parent menu as the original node.
cu,
Frank
| Comment | File | Size | Author |
|---|---|---|---|
| #22 | 249668-clone-menu-link-22.patch | 4.3 KB | pwolanin |
| #20 | 249668-clone-menu-link-20.patch | 3.11 KB | pwolanin |
| #17 | clone_menu_v6.patch | 2.22 KB | Frank Steiner |
| #16 | clone_menu_v5.patch | 2.25 KB | Frank Steiner |
| #13 | clone_menu_v4.patch | 2.37 KB | Frank Steiner |
Comments
Comment #1
pwolanin commentedHmm, this might not be so hard for 6.x, but I'm really not sure this is a widely desired feature.
Comment #2
Anonymous (not verified) commentedHi,
we need that on our site, so I've made menu cloning a configurable option. You can activate "Clone menu entry" at the settings page for the clone module. The patch is conservative in that the option defaults to "off".
Maybe someone else finds it useful :-) It's against 6.x-1.0-beta2.
cu,
Frank
Comment #3
pwolanin commentedThis could even be done a little more simply, though the code looks basically fine.
Comment #4
kristi wachter commentedJust chiming in to say I definitely want this feature, and I hope you'll include the patch in the next release.
Thanks!
Kristi
Comment #5
cozzi commentedGiven the number of times I clone a menu (one for authenticated users and one for anonymous users) anything that would make that job easier would be a great help. If this feature will make light of this I too would use it.
Comment #6
guysaban commentedAny chance you can make this patch for the latest version of the Node Clone module?
Comment #7
Frank Steiner commentedNot sure what you mean. The patch applies to the 1.0 and the latest -dev version?
Comment #8
guysaban commentedI could not apply the patch. I must check my setup further before I make any comments. Thanks for the getting back to me.
Comment #9
Frank Steiner commentedIt should be applied in the node_clone/ directory with "patch -p0 < clone_menu.patch"
Comment #10
Frank Steiner commentedBug fix. The menu entry didn't get the module-field set causing problems when re-editing a cloned node.
Comment #11
Frank Steiner commentedForgot to remove two fields from the cloned menu, causing the new menu entry to overwrite the old one (because it the same mlid).
Comment #12
pwolanin commentedPlease conform to Drupal standard code style.
Comment #13
Frank Steiner commentedComment #14
pwolanin commentedsee: http://drupal.org/coding-standards
e.g.:
You might also want to use: http://drupal.org/project/coder
Comment #15
Frank Steiner commentedI'm sorry :-( I AM using the coder module and it didn't return any more warnings for my _v4 version, so I relied on this. My version might be outdated, I will check, and try to work on it manually otherwise...
Comment #16
Frank Steiner commentedOk, coder indeed doesn't find the "x=y" problem, using the latest dev from Jan 21. I was just relying on this, my fault!
I've checked against the coding standards weg page and corrected some indents, the assignments etc. I hope everything is correct now. I'm really sorry about this!
Comment #17
Frank Steiner commentedI've re-worked the patch and changed the direction of the menu creation, i.e., I start with a default menu object and fill in only those values that you can enter in the form. I hope this will be more "future-safe" than cloning the existing menu item and resetting those settings that I'm currently aware of. Those "hidden" settings might change more often.
Comment #18
attheshow commentedPatch in comment #17 worked great for me. RTBC!
Comment #19
pwolanin commentedSeems like it needs work - for example, you are not unsetting the mlid.
Comment #20
pwolanin commentedAh, I see - the mlid is 0. Still, menu_link_save() sets all the defaults, so I think we can skip the extra prepare call.
also, terminology is a bit confused - we are cloning the menu link.
Comment #21
pwolanin commentedneed to add the new variable to hook_uninstall
Comment #22
pwolanin commentedcommitting this patch.
Comment #24
Frank Steiner commentedHi,
sorry for reopening such an old fix, but I've to admit that I didn't test your patch well enough. At the first glance it seems the menu is cloned correctly because in the edit form the menu entry is visible right after the clone (on the initial edit of the node).
But when you re-edit the cloned page after saving it, the menu entry is no longer shown in the node edit form. It is still a available in the menu edit form, but it has only "edit" and no "delete" link available.
The reason is the "module" column. With the current code, the column is empty for a cloned menu entry. For a newly created node it has the value "menu". Now when I debugged that I remember that I stumbled on this issue long time ago when I wrote the patch. I didn't want to write
because I thought "what if the value ever changes, or there are some other things that must be set?". Therefore I called
trusting that it would set all things like the module column to the correct values :-)
Setting the module column to "menu" manually for a cloned menu entry makes it deletable in the menu edit form and also shows it again in the node edit form. Thus, we must either set
in your patch, or call the nodeapi prepare code.
cu,
Frank
Comment #25
Frank Steiner commentedJust saw that you fixed this in 1.3 by
I was still using -1.2 so I missed the fix :-)