Skip to main content

October 3, 2018

What is a Drupal Entity and How Does it Work?

Thought by Ray Saltini, Director, FFW Center of Excellence
Line art of a Drupal logo over various scientific images

For anyone who's ever looked up a definition of a Drupal term and still wondered what it means, here are some practical explanations you can use to navigate the Drupal-verse. This is the latest in a series on Drupal-specific terminology.

The first thing you need to know is Drupal has more entities than Star Trek... a lot more. A simple Google search returns more than 6 million results for Drupal Entities, compared with less than 2 million for Star Trek Entities. Fascinating.

Drupal has more entities? Who knew?

What are entities?

In practice, developers, project managers and Drupal experts will use the term ‘entity’ to refer to a lot of different things. The only way to really understand what we’re talking about is to know and understand the context in which we are the making reference. So if we’re talking about configuration, we might be referencing an exportable set of data. If we’re talking about content, we could be talking about a single content node, a user, a menu, or any number of other things that belong to the content side of things. We could also be referring to an entity subtype, entities that have a common set of fields, which are also sometimes called a bundle.

Confused? Understandably. For many reasons this is one of Drupal’s most complex concepts. It’s a good idea to begin with Drupal’s documentation to get a basic understanding of how the term is used.

Proper Definitions modified from Drupal.org Documentation:

Entity - An item of either content or configuration data, although in common usage, the term often refers to content entities. Examples include content items, custom blocks, taxonomy terms, and definitions of content types; the first three are content entities, and the last is a configuration entity.

Entity type - The overall type of a content entity. Examples include content types, taxonomy terms, and custom blocks.

Entity subtype - Within a content entity type, a grouping of entities that share the same fields. For example, within the content item entity type, a farmers market site might have entity subtypes (also known as content types) for static pages and vendor pages, each with its own group of fields.

In plain speak, an "entity" is simply a unique or special thing on your site. An entity can be something that technical teams configure on the back end, or they can be a kind of content item that an editorial or marketing team interacts with.

Most entities have both a type and a subtype. For example, an entity type might be "custom blocks," where each of the different types of custom blocks is an entity subtype. A contact form is an entity type; a specific kind of contact form is an entity subtype.

What next?

If you've got questions about specific Drupal terms, let us know. Drop a request for a definition in the comments and we'll add it to our next ABCs of Drupal post. 

Comments

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.