Entities, Bundles, and Fields, Oh My! (Lesson 4 from DrupalEasy)

Have you ever tried to build a website prematurely? I certainly have. On my Drupal development journey, I've started building more websites than I care to count. Notice I said "started."

I always feel like I have this great idea and I know exactly how I want the website to look. So I install Drupal, and I'm off to the races! Then I realize I haven't taken the time to really vet out how I'd like the website to function.

Obviously, not thinking through functionality is a major problem, since planning the information architecture is probably the most crucial step in a website's building process. Attempting to go back and alter the foundation of a website after it's built is often extremely difficult--and sometimes impossible. Before starting, I need to understand Drupal's information architecture and how to use it to fit my needs.

Through my time in the Drupal Careers Online course through DrupalEasy, my eyes have been opened to the wonderful world of entities, bundles, and fields. This has been such a game changer! Drupal's Entity API is one of the key elements that sets it apart from other CMS systems. Defining a site is so much easier once you understand the "building blocks" (ie. entities, bundles, and fields), specifically ContentEntityBase and entities that extend it. The diagram below is a simplified depiction of Drupal's core Entity base class, ContentEntityBase, and the entities that extend it.

Drupal entities diagram

Each fieldable entity that extends ContentEntityBase has its own special features and can provide multiple types of itself, called bundles. (Users is the only entity not able to be bundled.) While this is just the tip of the iceberg in understanding Drupal's Entity API, hopefully it piqued your curiosity.

Taking the time to design your website from the ground up and having a firm understanding of entities, bundles, and fields could be the difference between simply starting a website, and actually completing one that's functional and efficient. I'm glad to say that I'm well on my way! Happy learning, friends!

Note from Drupalize.Me trainer, Amber Matz:

Get started learning about modular content in these tutorials from Chapter 2 of the Drupal 8 User Guide.

And module developers, learn about Drupal's Entity API in this series of tutorials:

Related Topics: 

Comments

Add new comment