CiviCRM Entity is a contributed module for tightly integrating and extending CiviCRM with Drupal. This module exposes CiviCRM API entities as proper Drupal entity types. Making CiviCRM data available as Drupal entities has many advantages, including integration with Rules, Views integration not provided by the CiviCRM core module, Entityreference, among other popular Drupal modules. I’d like to present another advantage of Drupal entity types, and that is Drupal fields.
By enabling CiviCRM Entity, you can add Drupal fields and associate with CiviCRM entity types like Contacts and Events. There are hundreds of Drupal field types, and any field type can be used with CiviCRM Entity. Why would you want to use Drupal fields with CiviCRM data? Shouldn’t CiviCRM custom fields be used? The correct answer is, use the right tool for the job.
CiviCRM is great at having the business logic and infrastructure to support event registrations. CiviCRM has price sets, price fields, and custom fields for collecting information from users when they register for events, as well as the logic and structure that goes with payment processing and financial accounting. Use custom fields to gather and store specific user entered information, the kind of data that later is pulled in reports.
What Drupal does well is manage content and presenting content to the user. Need a mobile responsive slideshow? Drupal handles this very easily. Add a regular image field, create an image style, install the Flexslider module, and configure your field to display as a slideshow. Images attached to an event and presented in a slideshow are not the type of data that event organizers need in their CRM reporting, so let Drupal do what it does well, store and present this kind of data. So for presentation of complex or multimedia data, use Drupal fields.
How can you take advantage of what CiviCRM and Drupal both do well, simultaneously?
A lot of new development of CiviCRM Entity has been funded by clients who are interested in the admin and user experience of CiviCRM’s event management and registration services. Event registration is a very public facing bit of functionality. Organizations want users to be able to browse for, learn about, and register for events, from a mobile phone. Events tend to have auxiliary information needs including lodging information or registration, downloadable brochures or other information documents, multimedia presentations of video or slideshows, integrated maps, etc. Often events are managed by non-techy admins or volunteers.
When you install CiviCRM Entity, you get Drupal based view page and edit forms for all exposed entities. I’m going to limit my examples to Events in this article, but the same applies for all entity types. You can create, update, and display CiviCRM Events, and never leave Drupal. The view page has the path
<site_root>/civicrm-event/[id] where [id] is the event id, and <site_root> is the base url of your Drupal website. The edit form is
/civicrm-event/[id]/edit and new events can be created at
This view page and edit form are “standard Drupal”, meaning that all fields and properties that are displayed can be managed in typical Drupal fashion. I highly recommend installing the Display Suite (DS) module, and its submodule Display Suite Forms to take full advantage of the possibilities, as you can configure field groups, layouts, and use the provided Display Suite field formatters for many of CiviCRM’s properties. With DS Forms you can also choose to hide properties from the edit form, although you will be forced to include any API required properties.
Add and Manage Fields
To configure the event form, go to the Manage Fields page for the CiviCRM Event entity type, at
/admin/structure/civicrm-entity/civicrm_event. Here you can add field groups like horizontal or vertical tabs, add Drupal fields, and configure the order the elements appear on the form.
Similarly, there is a standard Manage Display form for every entity type. As with nodes and other Drupal entity types, you can configure multiple view modes such as Full Content and Teaser. The Full Content view mode is configurable at
/admin/structure/civicrm-entity/civicrm_event/display/full. Here you can enable DS layouts, add field groups, configure which fields display and the formatters for those fields.
You get this capability by installing CiviCRM Entity, and you can display any event information and edit most of the data associated with events. We’re a long ways into the process of Drupalization, but we can go further.
New Field Types
As of CiviCRM Entity 2.0-beta4 there are now 7 submodules that define Drupal field types that can be used to augment the Drupal based user and admin experience. 3 of those modules are specifically for Contacts, and 3 are specifically for Events, and one is for any entity type. Instances of these fields can be added via the Manage Fields page.
Watch for the future blog articles as I will talk about these new field types and how to use them.