5 Fields Modules for Drupal 7

Posted by Art Williams on December 21, 2011

The addition of Fields in Drupal 7 core has created quite a shakeup in the modules that interact with fields and create new kinds of fields. In Drupal 6 they were all CCK field modules, but now many of them have changed names or been replaced completely with new modules that better leverage the Drupal 7 entity concept. Over the last few month, these five modules have become some of my favorites for those sites that need more complexity in the fields that are created and how they relate to one another.

References

The References module contains the ‘node reference’ and ‘user reference’ modules that were separate in Drupal 6. There are two other approaches to this same idea in the Relation and Entity Reference modules, but I find this module just works the way I expect without any headache even though it’s only a beta.

I use these modules when I need to link a node to a user or to another node. For example, I may want to link an article to the profile of the author and I can use node reference. If I want to link to the author’s user account I would use user reference.

Note (12/27/2011): As Larry Garfield pointed out in the comments, References module is planned to be deprecated once Entity Reference module has the same or expanded capabilities.  As of this date, I would still recommend References for production sites, but keep an eye on Entity References and plan to upgrade once it is ready.

Corresponding Node References

Corresponding Node References is a great little module that solves a usability issue easily and elegantly. This module will let you link two node reference fields in different content types so that if one changes the other will also change. The purpose of this is to allow you to have two nodes like to each other bi-directionally. Then if one changes they both change.

I have used this module in a situation where a company’s website has employee profiles as nodes and the company is divided into many different industry teams. I need to provide a way to assign a profile to an industry when editing the profile, but I’d also like to be able to pull up the industry and change the profiles assigned to it without needing to also go edit the profiles.

This module gives you a settings page where you map the two node references as pointing to each other, then the modules handles the process of keeping them in sync.

Field group

The Field Group functionality allows you to wrap a fieldset, div, vertical tab, or horizontal tab around a group of fields in your content type or entity. The precursor to this module was part of CCK in D6, but is its own module in D7.

I use this to group similar fields and make it easier for the site manager when creating content. The vertical tab display is especially helpful if the fields you are grouping are optional fields. You can place them in a vertical tab just like the publishing options on the node/add page. This modules will also create groups around fields on the display.

Field Collection

Field Collection is similar to Field Group at first glance, but rather than just visually grouping fields together, this module will create a new entity where the fields in the group live. The reason this is important is because now the content creator can create multiple sets of fields.

Let’s say you have a site that displays race schedules for local 5Ks and the results for those events. You could set up a content type called race where all the event information lives, then setup a field collection within that content type for results. The field collection will contain the fields’ name, time, race number, age, etc. The content creator can add as many line items of results to the race content type as they need.

My rule of thumb for when I use a Field Collection instead of a Node Reference is if the content in the collection shouldn’t be edited outside the context of the parent node. So race results on a race node are a field collection, but linking an authors profile node to his article use a node reference field because the profile and article should be edited and created separately.

Conditional Fields

Conditional Fields is my new favorite field module. It gives you the ability to make certain fields conditional upon the state of another field in the content type. It will even use some cool jquery animation to hide and show the conditional fields if you want.

I recently used this on a content type to allow hierarchy of nodes. By checking a box that the node is a child, then the select list of available parent nodes appears. I find that this kind of functionality increases usability of the site for the end user dramatically by only displaying necessary fields.

The Fields capabilities in Drupal 7 has been my favorite improvement over Drupal 6. While much of the functionality above may have been available in Drupal 6 CCK modules, the new interface and tighter integrations of Fields has made all the difference. If you know of any other field modules that have made you site building easier or improved the usability of your sites, please leave us a link in the comments.

MONTHLY MARKETING INSIGHTS.

Get thought-provoking and actionable insights to improve how your firm makes a connection with your customers.

LEAVE A COMMENT

The content of this field is kept private and will not be shown publicly.

Plain text

  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
Submitted by Ben Nash on Wed, 12/21/2011 - 7:13pm

I've used References and I can't wait to use Field Collections and Conditional Fields. Thanks do the great review.

Submitted by Mirc on Wed, 12/21/2011 - 9:02pm

Another usefull modules: CCK table and < href="http://drupal.org/project/double_field">Double field.

Submitted by Perry Jain on Thu, 12/22/2011 - 12:43am

Good job! thanks for sharing.

Submitted by Art Williams on Thu, 12/22/2011 - 11:32am

@Mirc Thanks for both of those. I can see how they might be useful in the right situation.

@ipwa More good display widgets, thanks!
*I'll look into that issue.

Submitted by Gaurav Sharma on Fri, 12/23/2011 - 11:50am

i have been using all these modules except
"Corresponding Node References" as it is unnecessary. Becasue "references" module has back reference capability in 7x.2.0 or later development versions.

Submitted by Art Williams on Fri, 12/23/2011 - 12:07pm

@Guarav: That will be a great addition to the module. Where are those settings. I'm using the 7.x-2.0 version and I don't see any options for "back reference".

Submitted by Larry Garfield on Sat, 12/24/2011 - 2:04pm

Note that References is informally deprecated in favor of Entity Reference. All of the involved maintainers are trying to get Entity Reference up to snuff to replace References as the de facto reference field system.

Submitted by Art Williams on Tue, 12/27/2011 - 9:42am

Larry,

Thanks for the heads up! I noticed that was the case, but for now I can't recommend Entity Reference until it catches up with References. Once that happens I can update my recommendations. In the mean time I'll make a note on the post.

Thanks again,
Art

Submitted by Miki on Thu, 12/29/2011 - 5:18am

Nice list, Drupal 7 fields are definitely big improvement.

I used a lot of custom compound fields in my Drupal 6 projects so far. For each of those I had to create separate module and it was very nice and clients liked look and feel, functionality also.

Looks like Field collection will replace my custom modules, have to give it a try.

Nice collection, thanks!
Miki

Submitted by Amir on Sun, 04/15/2012 - 12:50am

Thank you all for sharing...
I found them really helpful,
Amir

Submitted by Amy Peveto on Wed, 05/23/2012 - 9:48am

Nice addition, Peter. I can think of a few instances where that module would be helpful.

Submitted by Monsoon on Mon, 09/10/2012 - 7:22am

Hi,

I am searching for similar functionality mentioned in Conditional fields module as well as auto assign role, thanks for this great review.

I want to know if Conditional Fields module can hide and show a group of fields altogether?

Please comment on this specific case of Language professional who signs up on a single form created in profles2 module. He can signup for multiple roles by selecting check boxes for Peer-review, Interpreter, Language Teacher, Translator.
Selection of each check box should add groups of fields to the signup form.

2- Also please let me know how to assign him automatically roles corresponding to check boxes

Thanks in advance.

Submitted by JD Collier on Mon, 09/10/2012 - 9:36am

@Monsoon: I haven't tried to show/hide multiple at once, but it looks like it can support it. For each dependency you add, you select if it is an AND or OR so perhaps that means it can do more than one. You might check on the project's issue queue. Sorry, I can't help on the auto assign piece Again, you might want to see if the community in the issue queue can help.

Submitted by Ariel on Mon, 11/05/2012 - 1:41am

Thank you for sharing! I'm new to Drupal and this post is really helpful :)

Submitted by Amy Peveto on Mon, 11/05/2012 - 8:56am

Glad to hear it, Ariel! We've been writing about Drupal for awhile — feel free to look around the blog more, there's plenty to learn! :)

Submitted by Edgar on Tue, 03/12/2013 - 3:01pm

Greetings. I am having some difficulty on a project. I created a content type (Banner) and setup the Flexslider module to display a series of rotating slides. I created a view block and everything is working great on the home page. What I would like to do is setup the view to use a node reference as the filter to select which slides to include, so that the block will only display if the NID matches the current page.

I have been experimenting with both References and Entity References modules with no success. I can create the reference field in my content type, but I can not find a way in Views to match my data to the current page node reference. Below is the basic approach that I am looking for:

1. Create content and assign a reference to an existing node.
2. Use block in Views to display only content that matches current node.

Any help or pointing me in the right direction would be most appreciated!!! Thanks so much for your time!!!

Edgar