By wrb123 on
Hello,
I have the following:
Node Type: blah
-has title field
-has nodereference field
I would like to, as a way to allow users to add many nodes of this type at once, let users do the following on the node add form:
Title: cat, dog, rabbit, chicken
Nodereference: animal (this is a node of a different type)
Resulting in 4 nodes:
Title: cat
Nodereference: animal
Title: dog
Nodereference: animal
Title: rabbit
Nodereference: animal
Title: chicken
Nodereference: animal
Can I do this with a small amount of custom code in a template file somewhere? Is there already a module that does this? Someone suggested Rules but that seems rather bulky just for what seems to be a minor thing.
Thanks!
Comments
This may not work, but it's
This may not work, but it's an idea you could try...
My approach would be this: the user is creating a node with "a,b,c,d" in the title and a node reference field that points to X. We want 4 nodes with titles a, b, c, and d all with node references that point to X. Let's try using hook_nodeapi to perform the creation of these extra nodes when this original node is getting saved. Also, lets let that original node get saved, but it will only be creating the first item in the series - a in this case. We'll have some PHP code create nodes b,c,d as copies.
Definitely test and clean it up, but hopefully this gets you started.
Credit..
Node clone code is from: http://lists.drupal.org/pipermail/development/2008-July/030507.html