A deliberately simple way to invent nodes on the fly in order to refer to them via entityreference.

Just type a title into an entityreference autocomplete field, and if no match is found, a placeholder of that name will be created silently, instead of complaining.

This is a simplification from other create-and-reference solutions as it assumes *no* action on the users part. Of course, it also does not allow the editor to add any *more* detail about the newly created target entity at the time, but if you want that, I endorse references_dialog.module.

This utility co-operates interestingly with feeds.module, as you can import items that refer to other items by name, which will be linked to without intervention.

Both single and multiple (tags) UI for data entry are supported.

Usage

  • Add an entityreference field to your content type. Use the "Autocomplete" or "Autocomplete (tags)" widget.
  • In the field settings, check the new box labelled Autocreate target if not found. (You must use 'simple' entity selection mode, using a view lookup cannot be supported fully #2634374: Does not work with a View as an Entity Selection?).
  • Now when adding content containing this field, you can just make up stuff to reference. If possible, the normal autocomplete search suggestions will still work, but i you ignore the suggestions and use your own text, form validation will no longer fail, and the target entity you asked for will be created and linked.
  • It will of course be basically empty until you find it and fill it in, but this UI utility will rapidly speed up data entry for lightweight structures.

It was built to support a film database (basically an IMDB/Freebase clone) and entering lots of related names that were eventually going to become full linked pages was a bit chicken-and-egg. This makes this happen.
Having this enabled at the same time as doing data imports (via feeds.module) was a huge advantage as the order tables were loaded in became less problematic.

Other modules in this space

Most of these are trying to do create-and-reference in D7. I am looking only for those that play nice with entityreference, not just nodereference.

references_dialog.module

RECOMMENDED. You can use this as well to create referred nodes on the fly.
The only reason it's not the entire solution is because you have to choose
to do so each time.

Use references_dialog AS WELL AS this module for the best mix.

autocreate.module

DO NOT USE. Not sure what happened with the D7 branch, but it decided to make
its own field type instead of building on entityreference. Incompatible.
However, it did have the innovation of declaring a 'template' not to be used
when autocreating a target. Good idea. UI is weird though. Cannot use.

noderefcreate.module

Runner-up to references_dialog. However only supports nodereference at this
time.

entityconnect.module

A contender for generic reference create and edit. May work.
However button layouts it added to the UI were inconsistent under vertical tabs.
Caused visits to new form pages when creating new items.
This was the main reason references_dialog won.

Project information

Releases