The Embedded Node Form API lets you stitch multiple node forms together.

Have you ever needed to stitch together several node forms into one giant form, perhaps as part of a multistep form workflow?

Look no further! This module provides an API for:

  1. Obtaining the form elements for creating a node of the desired content type (in a way that the form elements can still be altered)
  2. Stitching the elements into a larger form that can be rendered like a normal custom form
  3. Processing / fixing-up the data collected through the larger form at the appropriate times in its workflow
  4. Submitting the data programmatically through the proper node forms so that the nodes are constructed as expected

Prior to this module being in existence, there were several approaches you could take:

  1. You could build a custom form out of standard FAPI form elements and avoid using Field API widgets. You could then programmatically submit each of the node forms when the whole form is submitted. Unfortunately, this makes it difficult to accept content that's compatible with the nodes -- attempting to show a file upload widget is notoriously difficult with this approach.
  2. You could attempt to render each node form one at a time on the page, altering it as its displayed to only show the elements you want to show. You could then wire up the submit logic for each form so that it creates the appropriate node and then displays the next form. Unfortunately, this makes it difficult to do an "all or nothing" style workflow where everything gets created at once, and could lead to a very inflexible workflow.
  3. You could attempt to have the FAPI render each of the node forms into render arrays, then stitch them together into a larger form that is able to use Field API widgets. The custom form could then submit each of the node forms when the whole form is submitted, in the format that each node form expects. Depending on the fields and widgets involved, this could sometimes lead to the form rendering strangely, but is ideal for making flexible workflows.
  4. You could write a module that defines a new type of entity that is a composite of the fields from the other nodes you want, and then have its create / edit forms collect values and submit them into forms for the underlying node types. This is tedious to write, but would leverage Drupal's standard Entity / Field API form rendering to present the forms, allowing widgets to render consistently.

The current 1.x version is an implementation of approach #3 above. We'd envision a 2.x version at some point that might implement approach #4, but the current solution is workable.

Supporting organizations: 
client who commissioned the project

Project information

  • caution Minimally maintained
    Maintainers monitor issues, but fast responses are not guaranteed.
  • caution Maintenance fixes only
    Considered feature-complete by its maintainers.
  • Module categories: Content Editing Experience, Site Structure
  • Created by GuyPaddock on , updated
  • shieldStable releases for this project are covered by the security advisory policy.
    There are currently no supported stable releases.

Releases