Hi,

I'm wondering if it's possible for Drupal to utilize ONE module that displays DIFFERENT forms (depending on the URI).

Here's my implementation situation.

I want to create a "Fiction" (like a novel). A "Fiction" contains "Chapters", which are basically sub-nodes of a "Fiction" (very similar to the pages of a book). A user creates a "Fiction" that has fields such as "Genre", "Rating" (set up through taxonomy) and "Story Summary" (the node content).

When a user who owns the fiction is viewing a Fiction Node, they are permitted to add "Chapters". A "Chapter" inherits the "Genre" and "Rating" from the root Fiction node. The user is the allowed to write a "Chapter Body" (the node content).

One reason I did not use the existing book module is because the UI for the book isn't clear for my target audience. If they created a book with a genre, then it would be annoying if they had to specify the genre every time they posted a chapter.

My problem is that I want to call this customized form and can not create it. I create a link that points to "fiction/addchapter/38" (to edit fiction with node 38). I use my callback for viewing fiction (fiction_page) as follows:

if (arg(1) == "addchapter") {
print fiction_chapter_form(arg(2));
break;
}

The function fiction_chapter_form defines the logic for displaying form elements. The problem is that it does not display the standard Drupal form elements that are shown if you call something like "fiction_form" or "node_form".

I can personally think of three ways to get around this:

  1. Create TWO modules - a "chapter" module and a "fiction" module. Create a link in the "fiction" module list of links (such as "add chapter to story") and then that will bring the user to the "chapter" module. You need to enable both. I personally find this a bit of a pain but it may be a necessary evil.
  2. Define all of the form elements myself. I really prefer not to do this.
  3. Somehow find a way to import information into the node_form call. However, this would involve modifying core code to allow the insertion of the elements and to ensure the system executes the appropriate insert/update hooks for the module. I'm not against this - I want to know if it would be possible, and more importantly, if it would be beneficial to anyone besides me.

Thank you,

-- Irwin