I need a form which will allow creation of several related nodes at the same time. All of the nodes involve CCK fields.
I would like to use as much of CCK's built-in validation, submission, input widget, and security functionality as possible/practical.
What is the best way to accomplish this in Drupal 6? Are there 'best practices' or docs anywhere?
Here are 3 possibilities I can see. I would love feedback on whether any of these would work, or if there are even better options.
1.
- start with the standard node creation form for content type foo.
- modify the form by adding fields for content type bar, using hook form_alter [can cck widgets for content type bar be inserted directly?]
- use a custom submit handler to create node of type bar when the form is submitted [can the standard cck handler be called? or do i need to 'manually' construct the node object, do my own validation, and use node_save?]
2.
- create a new, custom form that concatenates the 'normal' node creation forms for the relevant content types.
- then use hook form_alter to modify the forms as necessary.
- allow standard cck submit handlers to do the work of creating the nodes.
3.
- create a custom form from scratch
- create the nodes in my own submit handlers, using node prepare, node save, etc.
If found documentation on re-using the standard node creation form, but creating multiple nodes at the same time is not mentioned.
Using hook nodeapi and hook form_alter is documented in a post on advomatic's site, but the particular method descrube seems to require polluting one of the content types with 'dummy' fields.
Thank you very much for your help!