0

I am very new to Drupal. I have a situation where I have 3 content types, say A, B, C.

For each node instance of type A, there should be 3 corresponding nodes instances of type B. And for each instance of type B, there should be 5 corresponding nodes instances of type C. So in total 1 + 3 + 15 = 19 nodes.

Is it possible to automatically create the B and C node instances when the A node is created? And it is automatically possible to delete them if A is deleted? In other words, I would like to create tree-like instances of nodes.

Is this possible in Drupal? Is there a module for this, assuming I am creating the 3 content types A, B and C? Alternative solutions/ideas are welcome too.

2 Answers 2

1

I think you can do it using hooks you can use hook_node_save it will be execute after node A is saving to add a new node B,C after you create A hook_node_save($node) { if($node->type=="A") { node_save(B); node_save(B); node_save(B); node_save(C); node_save(C); node_save(C); node_save(C); } }

1

In order to relate content to each other you could try Relations module. But you'll have to extend it in order to automatically create the linked node and delete them if the master node is deleted. Take a look over the docs of this module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.