When building dynamic Drupal sites, one of my favorite underappreciated features is the humble "View mode." View modes let you define how content is displayed in different contexts—without duplicating code or creating a mess of templates. Whether you want teaser cards, compact field lists, or custom layouts for API output, view modes are the key to truly flexible content presentation.
What Are Drupal View Modes?
A view mode is a display variant for entities (like nodes, users, or custom entities) in Drupal. Drupal comes with a few built-in view modes, such as "Full content" and "Teaser" for nodes, but you can add as many custom ones as you need. Each view mode allows you to configure which fields are shown and how, through the "Manage display" tab for each entity type.
How to Create and Use Custom View Modes
- Enable View modes: Head to
/admin/structure/display-modes/viewand add a new view mode for your desired entity type. - Configure fields: Visit the "Manage display" tab of your content type (e.g.,
/admin/structure/types/manage/article/display). You’ll now see your custom view mode as a tab; arrange and format fields as you like. - Display your view mode: When rendering content (in views, templates, or code), you can specify which view mode to use. For example, in a custom block, you might call
$view_builder->view($node, 'your_custom_mode').
Common Use-Cases
- Custom cards: Display event cards or staff profiles in a grid with only select fields.
- API formatting: Create a minimal or JSON-specific view mode for REST or JSON:API output.
- Email templates: Use custom view modes to render fields differently for notification emails.
Pro Tip: Use the Display Suite Module
For even more control, the Display Suite module lets you create layouts (including multi-column and sectioned displays) directly from the UI, and assign them to any view mode.
View modes are a powerful, sustainable way to keep your Drupal site’s content presentation flexible and maintainable. Next time you need a new display style, create a view mode instead—you’ll thank yourself later!
Happy Drupaling!
— Drew


Leave a Reply