This module allows you to define a priority order for entity fields so that if a field is empty, a value from the next field in the sequence is used. This avoids the need for custom code when you want to display content from one of several optional fields.
EntityFallbackValue provides developers with a flexible cascade system to retrieve entity field values based on defined priorities.
The problem it solves
When displaying content, you often want to show a value that can be carried by multiple optional fields. Instead of writing custom logic each time, EntityFallbackValue lets you define a priority chain once — if the first field is empty, it falls back to the next, and so on.
Features
- Plugin system — define your own fallback chains with a structured, reusable plugin API
- Token integration — use fallback values anywhere tokens are supported
- Twig method — access fallback values directly in your templates
Example use case
An entity has three optional description fields: Long description, Description, and Chapô. You want to display whichever is filled in, in that priority order. Define the chain once via a plugin, then use the token or Twig method to retrieve the resolved value — no custom PHP needed at the template level.
Documentation
For installation and usage instructions, see the README.txt file included in the module repository.