Check your version

This collection covers a topic in Drupal 7 which may or may not be the version you're using. We're keeping this tutorial online as a courtesy to users of Drupal 7, but we consider it archived.

Alternate resources: 

Working with Entities in Drupal 7

Entities were introduced in Drupal 7 as a way of taking the things that people loved about nodes + CCK in Drupal 6 and applying them to other types of data like users, comments, and taxonomy terms. The Entity API in Drupal 7 provides a set of common functions and classes to make it easier for developers to create their own custom entity types or to work with other already existing ones in a generic way. The API in Drupal core however is still missing some really useful tools and is supplemented by the Entity module in Drupal contrib which we'll make heavy use of throughout the series.

In this series we'll learn about the interplay between Entities, Entity Types, Bundles, and Fields and how to write custom code to deal with each of these things. The Entity API demo site files that we use in this series is all located in the Lullabot GitHub, as well as in zip files, which are attached to the respective video pages, under the Downloads tab.

This series covers:

  • What entities are and how they fit into the Drupal ecosphere
  • EntityFieldQuery
  • Entity classes, what they do and how to override them
  • Providing an admin UI for adding/editing and deleting entities from Drupal
  • Making entities fieldable
  • View modes
  • Creating custom UI's for dealing with entities
  • Describing entity properties to Drupal
  • Views integration for entities
  • Entity Metadata wrappers
  • Making entities revisionable

And much much more. This series assumes that you're already familiar with the basic tennents of writing modules for Drupal and makes use of things like hook_menu() without spending time explaining them. If you're not familiar with Drupal module development, you might want to brush up by watching our Module Development for Drupal 7 first.