Advanced Components
  • Welcome
  • Start here
    • Setup
    • Dependencies
  • Getting Started
    • Front-end tooling
    • Create a new D9 theme
    • Component Architecture
    • Drupal Best Practices
    • Drupal Attributes
    • Twig Blocks
  • Basic Components
    • Global styles
    • Adding webfonts
    • Heading Component
      • Improving the Heading
    • Button Component
  • A component's lifecycle
    • Hero Component
    • Include statements
    • Drupal prep
    • Drupal entities
    • Homepage content type
    • View modes
    • Add Hero to homepage
    • Drupal cache & twig debugging
    • Twig template suggestions
    • Getting field values
    • Integrating the Hero
    • Drupal Libraries
    • Hero Image styles
  • Card component
    • Card Component
    • Component Variants
    • Card Variant
    • Author component
  • Drupal site building
    • Blog articles
    • View modes
    • Drupal Views
    • Author
    • Generate content
    • Adding Blog Lists to the Homepage
  • Drupal Integrations
    • Integrating the Card
      • Taxonomy terms
    • Integrating the Card Wide
    • Author integration
    • From our blog
    • Integrating From our blog
    • Featured Content
    • Integrating Featured Content
    • Blog image styles
    • Blog detail page
  • Extras
    • Image Styles
    • Navigation
  • Resources
    • Resources
Powered by GitBook
On this page
  • Whose line is it anyway?
  • Drupal entities
  • Entity references

Was this helpful?

  1. A component's lifecycle

Drupal entities

Whose line is it anyway?

Before embarking on this Drupal journey, keep in mind that your role in this process may vary. Depending on your team, your skillset or other factors, you may not be responsible for building the front-end and back-end of a project. For example, a typical project for me consists of an architect building all of Drupal's infrastructure, me, as a front-end developer building components in Pattern Lab, and perhaps a back-end developer integrating the components with Drupal. However, in other projects I may be responsible for building and integrating components.

Drupal entities

Typically in a component-based project, Drupal will use entities to build the components infrastructure in the back end. Entities such as content types, blocks, paragraph types, and even views, are some of the ways we can transition from a traditional development approach of building pages to a modular system of components.

Entity references

In our project, we have a large collection of movies. It would be nice to be able to pick any movie and turn its image into the hero for our homepage. Even better, it would be nice to be able to change the homepage hero to any movie at will. Well, we can do this by using an entity reference field for our hero in the Homepage content type. An entity reference field in combination with view mode display will allow us to achieve all of this.

Before we can add a Hero to the homepage, let's first build a new content type for the homepage.

PreviousDrupal prepNextHomepage content type

Last updated 3 years ago

Was this helpful?