In views displays use entity display modes instead of fields
Introduction
When displaying entities in views use entity display modes, not fields.
Decision
When building views, use entity display modes instead of field configuration when possible. If existing view modes don’t line up with the intended style or content availability create a new view mode to avoid affecting existing pages.
Context
View queries are faster and better optimized when the view queries the whole entity instead of adding joins to the field tables. It’s also easier to theme a display mode that can be reused across the site components outside the view's context than re-theming fields for one particular scenario. Having view mode templates keeps the theme clean and organized, and it’s easy to see which template is being used. Therefore, using display modes in views improves site performance and decreases the time required for theming.
Consequences
- Developers cannot use field overrides in the view and will have to write preprocess functions or override in the template.
- Aggregation options inside of the view are limited and may require a hook to achieve distinct results.
- For GROUP BY functionality, the option “force fields usage” must be used.
Exceptions
- Usage of fields will significantly simplify the solution.
- When the site exists and is already using fields.
- Core-provided views such as content.
- Table-formatted views.
Additional Resources
None