Optionally remove tab, provide API to return link
heyrocker - November 10, 2008 - 03:32
| Project: | Node clone |
| Version: | 6.x-1.0 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Jump to:
Description
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!
| Attachment | Size |
|---|---|
| menu_tab.patch | 2.86 KB |

#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?