So I have created a fair amount of websites in my career that relate data. But in Drupal, thus far I’ve rarely had a case to use the Entity Reference module. Which you’d think would be a prime candidate for relating things … but hey. I finally got around to using Entity References and wanted a slick way to allow content editors a means to Update or Create related entities. I think I found a nice solution.
My current project involves moving a legacy database of Presidential Documents, Locations and People into Drupal 7.
So after creating some entity references which relate a Person to: the place they were born, where they held a government office, where they died. I also relate Documents to the location in which they were created (city, state, location) and a relation to the Person who created the document. I wanted to allow my site editors a means to be creating a Document node and create a Person or Location inline (without leaving that browser page). I found the References Dialog module.
After installing References Dialog, you can configure an Entity Reference Field to make use of it. It’s important to note that an entity reference field must be using the Autocomplete widget to properly activate the references dialog. You cannot use the Autocomplete (tags style) widget — I learned that the hard way after like 30 minutes of wasted time wondering why the dialog wasn’t appearing!
So when configuring a field we can set what References Dialog options we want; these are in addition to the default Entity Reference options:
You can kind of see what this will appear as to content editor in the above image under Default Value. The module adds some AJAXified links below the textfield for the Location (in this case).
A better example is to examine a completed piece of Person content and click some of the links:
See above we have a completed Person entry and we reference person Abe Lincoln( with Node ID 12933).
The edit button brings up the related entity in its own window to allow the content editor to modify it without leaving the main content edit page.
Lastly if you’re creating content the Search button brings up searchable UI, similiar to the default Entity Reference search functionality — but it can be extended by configuring a custom View to supply your own searchable interface for your clients!
So this adds a great deal of functionality and enhances User Experience on top of what Drupal out-of-the-box would give!
note1: Currently References Dialog is in BETA. Without patches it does not support drupal core Taxonomy Reference fields — but they are working on it. They are also working on streamlining the modules CSS to be more friendly with community developed themes.
note2: Additionally the Search feature in References Dialog can use the Entity Reference Views integration to provide a custom search form to find related content quickly and powerfully. I may use it later! haha.
Looking for quality web hosting? Look no further than Arvixe Web Hosting!