I have the task of attaching two entities to each other, and both may not exist yet. So what I'd like is to create the second entity along with the first one if it does not exist yet.

So in the case of having a task and attaching persons, assume I already have created a person. Then I would like to add him to the task by typing in his name. But at the same time, when editing a task and the field does not find a name, I like to receive the option to create the person entity on demand.

Are there recommendations as of how to approach this?


The References dialog module might be an option (if you're using the references project).

This module extends reference fields like the user and node reference fields by adding links to add, edit and search for references through a dialog. This allows for a workflow where the user can create all the references to a node at the same time as she is creating it, a process which sometimes get's a bit backwards, when a user for instance needs to create all the facts for an article.

It doesn't do exactly what you've described, but it's pretty close.

| improve this answer | |

I am also adding Inline Entity Form to the list.

Provides a widget for inline management (creation, modification, removal) of referenced entities. The primary use case is the parent -> children one (product display -> products, order -> line items, etc.), where the child entities are never managed outside the parent form. Existing entities can also be referenced.

I learned of this module years after asking the question, but it works pretty good.

| improve this answer | |

You can use the Entity connect (v2-rc1 and v1-rc5 release only)

It will help you to improve the User Experience for creation of new entities or edition of linked entities on your entity reference fields.

The "add a new" button will enable you to add / create a new entity. The first form will be cached then the new form will be generated. Once the new form is completed and saved the user will return to the original form.

The "edit" button will take the user to the edit form of the referenced entity. Once the user is done editing, he is sent back to the previous form.

The Automatic Nodetitles module works fine with it. In addition with Entity connect you can edit existing entities.

You can read other options in: How to add "Content type B" from within "Content type A" and then display both together?

| improve this answer | |

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