Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm interested in extending this module so that a user can choose to clone a node, and then save the clone as a template. The templates could have individual names, and be accessed from a "My Templates" menu entry. When the user wants to create a new node, they can click on "My Templates" and choose the template they want, a new node will be created, opened in an edit window with all of the Taxonomy and Publishing options pre-set.
Comments
Comment #1
pwolanin CreditAttribution: pwolanin commentedHmmm, why not just use the existing nodes as the templates? Seems like you'd be halfway there at least.
Or, with the "reset publishing options", you could even have the template nodes be unpublished- you could just make a little block showing each user his unpublished nodes (templates) and construct the link to node/nid/clone. The only trick is to how to let users add nodes to this template list without letting them unpublish other site content.
To really customize this module for your particular needs would probably require some substantial development and probably a new module (the clone module is actually a relatively simple piece of code). You could either take this module as a basis to do it yourself, or sponsor development.
Comment #2
Chill35 CreditAttribution: Chill35 commentedI agree with pwolanin. I am using the module myself, and I think that with the module "as is", you can certainly make an unpublished node a template. Then you can clone that "template node" (you can even use the word "template" in its title), and modifiy some fields, as well as the title... and publish that clone. The fields would not be php fields, but can look exactly like... fields.
Let me give you an example :
- CREATE a node, mark it "unpublished", and give it this title : Template for annoucement.
- Fill it with all that should always be there, and put in place of your "variables" words in square brackets, such as [DATE], [NAME OF...]
- If you use php you can even use some code to retrieve information in a "smart" (dynamic) way in that node.
And then create a menu with links to these unpublished nodes.
You can also look at the following module : PageRoute, which does provide a "route" for creation of nodes. NO templates as such.
Good luck!
Comment #3
Chill35 CreditAttribution: Chill35 commentedmark it "unpublished" ----> do NOT make it as published.
Sorry about that.
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedThanks to both of you. I'll look into these suggestions :-)
Comment #5
GC_Chi CreditAttribution: GC_Chi commentedI just want to add that I think that using the clone module to create templates is a great idea. I was originally planning on using the prepopulate module, but it proved to be too limited. I eventually realized that the cloning module would do exactly what I wanted. I created node templates as you guys described and then replace the default "Create content" links with menu links that linked to "node/xxx/clone."
However this use of the clone mod is not obvious. In the dozens of posts about using prepopulate, no one mentions the clone mod. It would be an awesome extension of this essential mod to have be able to define templates, manage them in admin area and create template/clones in the menus or blocks.
Just my two cents. Thanks for this great mod.
Comment #6
Chill35 CreditAttribution: Chill35 commentedEaton, if you read this, I think it would be awesome to add a line on the module project page saying : you can use this module to allow pseudo node templating... something like that.
Comment #7
pwolanin CreditAttribution: pwolanin commentedCaroline, since it's my project, I'm not sure why you are appealing to Eaton??
Comment #8
Chill35 CreditAttribution: Chill35 commentedLOL... it's you allright.
Sorry, I don't know what that lapsus means. ;)
Comment #9
pwolanin CreditAttribution: pwolanin commentedAdded a link to the project page; closing since this is not a feature I'm not planning to support via any additional code.
Comment #10
1kenthomas CreditAttribution: 1kenthomas commented"stub:" what I would like to do is "mass clone--" create multiple nodes with data (such as directory, tax tags) filled by an argument. (As this may be possible via the current module once I look at it, I'll move on...).
kwt
Comment #11
pwolanin CreditAttribution: pwolanin commentedfor 6.x, here's a quick and dirty approach to restrict which nodes can be templates.
This is an add-on module, but more likely you'd put this code in some other larger module of site-specific hacks.
file: template_node.info
file: template_node.module
You could also so some other things if you are using simple node types - e.g. you could only allow 'page' nodes to be cloned and then on the subsequent alter hook, turn them into 'article' nodes.
Comment #12
miro_dietikerChecking for a match of t('Template') in a node title depends current language the node was reached. Please note it is generally possible that a node in german gets displayed with a current chosen language english.
This highly depends module setup and locale settings and is not the right way...
Comment #13
momper CreditAttribution: momper commentedsubscribe
Comment #14
chefarov CreditAttribution: chefarov commentedBook page clone misses child pages. I think the most import functionality in node cloning modules.
Is this going to be implemented?
Comment #15
tonyoconnell CreditAttribution: tonyoconnell commentedsubscribe
Comment #16
Anonymous (not verified) CreditAttribution: Anonymous commentedHave a look at http://drupal.org/project/node_template
Comment #17
Anticosti CreditAttribution: Anticosti commentedSubscribing
Comment #18
WorldFallz CreditAttribution: WorldFallz commentedJust an fyi--
i used the code in #11 but used a simple checkbox field to indicate whether or not the node should be considered a template then setup a view listing these template nodes with node/xxx/clone links to use the template. Also, I used field_permissions to control which roles can designate a node as a template. Works great.
Comment #19
blueantlabs CreditAttribution: blueantlabs commentedPost your code WorldFallz if you don't mind!
Comment #20
WorldFallz CreditAttribution: WorldFallz commentedyep-- i shoulda posted it. Here it is:
where field_template is a simple single on/off checkbox.
Comment #21
kenorb CreditAttribution: kenorb commentedGreat, I did the same feature of the templates (message templates). It only took two content types (template and actual content), a view and the hook from #20.
Comment #22
fuerst CreditAttribution: fuerst commentedFYI: Based on Node Clone I implemented a template mechanism this way: When adding a node you may click a link "Create from template" which let you choose from a list of nodes marked as template. After choosing a template node you get a node edit form prefilled with content from the template. Marking a node as to be used as a template is done by checking a box at the "Node Template" setting in the node.
Please have a look and let me know what you think about it:
http://drupal.org/sandbox/fuerst/1973572
Comment #23
motou CreditAttribution: motou commentedthe module Node Template does exactly what it is wanted. http://drupal.org/project/node_template
In that module any kind of node can be defined as a template, then one can create a node from that template.