User Level: 
Intermediate

Entities are a new concept that have been introduced into Drupal 7.  This is a higher level concept that most authors won't really care to too much about, but both architects and programmers will find very handy.

An Entity Type is a unit of data that can have fields attached to it.  Entity Types, in Drupal 7, include the following:

  • Nodes
  • Users
  • Taxonomy Terms
  • Profiles
  • Files

When an entity has fields attached to it, it creates something called a Bundle.

The Entity layer has been added into Drupal 7 for a few reasons:

  • To keep content from becoming cluttered - bundles can actually be used as "templates" for sub-categories of content where common fields are re-purposed
  • To provide a standard API for storage and retrieval - this makes things more manageable for back-end development
  • To open potential for non-MySQL Database use

So, why would anyone want to use Entities?

As a very practical example, a File Entity could be used for something like a pdf file of a curriculum vita for a professor.  This CV might have some specific information you would want to include as metadata such as the professor's name, research field, etc.  Each one of these specific data items would be a separate field that is attached to the File entity.  When these fields are added to this file Entity, we now have a specific "bundle" of data that we could call "CV File Bundle".

So what's the big deal?

For site architects, the biggest deal is that now non-node items, like files, can be queried with Views. This means some interesting things, such as the ability to manage files in a flexible, nimble fashion.  It also means that we can make items like this searchable for our end users, using Views.

For programmers, the standard API makes more complex module development easier.  It reduces the inherent learning curve that programmers often face when they have to take over someone else's work.

For back-end system administrators, it means that there's now potential to use databases other than MySQL.  This makes Drupal more platform agnostic by opening channels for additional database systems, such as Microsoft's IIS, or MongoDB.  Which is always good.

For more information on this subject, we encourage you to take a look at the included video content or visit drupal.org's An Introduction to Entities.

Related Video

Please note that videos which are provided from a source outside of OSU may not completely reflect OSU systems. Instead, use the provided video as a general guide to working with this particular subject.