Download & Extend

Optionally remove tab, provide API to return link

Project:Node clone
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (won't fix)

Issue Summary

I didn't like the Clone tab on a site I was build, I wanted a normal link users can click to clone a node. So I added an option to clone's settings which allows admins to set whether or not the tab appears. The sucky thing about this is you need to clear cache after you set this, to rebuild the menu. I'm not sure how to get around this.

I also created an API function to return a node_clone link so you can add it into your node's template. It adds a class but could be expanded to do full theming with a template file (flag module does something very similar.)

Would love to hear any feedback!

AttachmentSize
menu_tab.patch2.86 KB

Comments

#1

Thanks for this heyrocker!

I didn't pay attention to the code I was patching, so it took me a few minutes to figure how to add the link in my template. (I stupidly expected it to be part of the $node object or $links output)

Put this in your node.tpl.php file:

<?php print clone_create_link($node) ?>

#2

why not use the normal hook_link API for nodes?

#3

What do I need to do to just remove/hide the "clone" tab on node pages? I use Views to add clone links.
I have looked at the clone_menu() function in clone.module but don't know how to proceed.

#4

Version:6.x-1.0» 6.x-1.x-dev
Status:needs review» needs work

Looks basically ok, but as above, there ought to be an option to add this link to hook link, and also you need to add a submit function tot he form which calls menu_rebuild() when it's needed.

The alternative, of course, is a 3 line addition to a site-custom module to do hook_menu_alter().

#5

Status:needs work» closed (won't fix)
nobody click here