Understanding Entity Types, Bundles, Fields and Entities

Understanding Entity Types, Bundles, Fields and Entities

In Drupal 7, most of your sites content will be stored in something called an Entity. This is useful since Entities benefit from being findable and, by extension, translatable. To fully understand the power of Entities, you must understand the relationship between Entity Types, Bundles, Fields and Entities.

Entity Types

Generally, each new Entity Type that is defined in Drupal behaves differently. In the core version of Drupal, the most important Entity Type is Nodes. In the Web CMS distribution, we introduce two more Entity Types, these are Content Snippets and Data Entities.

As mentioned above, each Entity Type behaves differently. To demonstrate this, the table below shows how each of the three Entity Types listed above behave. 

Entity TypeGenerates a new page?Can be rendered in a block?Can be accessed by widgets?

Nodes

Yes

Yes

Yes

Content Snippets

No

Yes

Yes

Data Entities

No

No

Yes

Bundles

Bundles are defined as a subtype of an Entity Type. That means that two Bundles that belong to the same Entity Type will behave of the same way. Where they differ is that each can and usually will have a unique combination of Fields and a specific way to present those Fields.

Fields

Fields are probably the most powerful tool within Drupal 7. To start, a Field is given a definition of the type of information it may contain. The most common type of Fields are the textfield and textarea. Both of these can be used by content creator to save information in the form of text that can later be presented to users. Once a Field has its definition, it can then be attached to any number of Bundles. That means that those Bundles will gain the ability to store that specific type of information. Most important of all, is the fact that a Field can be defined as being translatable which allows a content creator to enter both the English and the French content at once.

Entities

Finally, an Entity is a single instance of a Bundle. To put this into more relatable terms, every time you create a new basic page node, you are in fact creating an instance of the basic page Bundle and storing information specific to that instance, more appropriately named Entity.

» Submit feedback
    Status: 
  • Accepted
    Topics: 
  • Support
    Types: 
  • User Guide
Back to top