Problem/Motivation
We have a number of issues around the confusing situation with Full/Default:
* #2834316: Node preview shows and defaults to "Default" instead of "Full" view mode
* #2639274: Unable to select "default" pseudo view mode in FieldFormatterFromViewDisplay configuration (not core, but relevant feedback from @yched)
* #2700147: Views uses non-existent "default" view mode, which causes Quick Edit to break
The main problem is that we have view displays and view modes and there is a default view display that is a fallback for all view modes that have no display enabled. The default view mode is "full" and there is often now view display enabled for it. And our API returns 'default' as fixed always-there default option instead of "Full".
More context
- Display modes can be created per entity type, and display config is created per entity type, bundle and display mode (node.article.teaser).
- There is a pseudo Default display mode but it's not a config entity and cannot be deleted or disabled.
- A Default entity display is created when fields are added through field UI, or the default display is saved.
- Entity display config can be deleted using drush cdel or config import, not through UI.
- If a specified display config doesn't exist or is disabled, it falls back to Default.
- If Default doesn't exist, a fallback is derived from base fields and extra fields that define display options in code (but not configurab fields added in field UI).
- When new fields are added in the UI, they are added to the Default display as visible, but disabled in others.
- Some display selectors use getViewModeOptionsByBundle(), which only include enabled displays.
- Some display selectors use getViewModeOptions(), which returns all entity view modes, even if a display doesn't exist for a bundle.
- Main entity displays define different "Full" displays: "Full content", "Full", "Taxonomy term page", "User account".
- Layout builder overrides use Full display when enabled, or Default otherwise.
Confusing
- If Full display is enabled, new fields only go to default and are easier to miss.
- Selecting a view mode without knowing enabled displays for the bundles and fallbacks is error prone.
- Hard to tell which is the main display in use in manage display.
- Layout builder override option moves from Default to Full if full is enabled.
Proposed resolution
@todo: Complete this, just some notes/ideas for now:
* Remove Default, make Full the fallback
* Maybe no fallback at all, no enabled display => no fields. Without a hierarchy of fallbacks, it is in 95% of the cases not what you want anyway
* Have a full view mode that always exists for all entity types
* Have locked view modes that can't be deleted
Remaining tasks
Review UX issues and decide how to proceed
Comments
Comment #2
wim leersComment #3
wim leersFWIW: this came up on Twitter again: https://twitter.com/marcvangend/status/840148831270449152.
Comment #4
berdirI assigned this to 9.x because it is a breaking change for configuration.
Now that 9.x has to be backwards compatible, I don't really know how to make the switch to not having a default view display.
Comment #5
wim leersWe have to figure out how to do this in 8. Perhaps our experiences in the past 2 years as a community have given us the insight how to do this in a BC way now.
Comment #6
andypostComment #16
ressaThis would be a nice improvement. I am currently building a site, and feel like I need to update both "Default" and "Full" to not run into problems down the line ...
Removing Default, and make Full the fallback would be great.
Comment #17
dalemoore commentedWhat does “Full” even mean? I know when you go to the screen you can tick the “Full content” box and give it its own view mode settings, but I’ve hardly ever done that. Not sure what “full content” means here. Is it all available fields? Doesn’t seem so. I’d love some context behind why it exists/it’s named that.
I don’t know that naming it full content is accurate. I can create a ton of fields and on the default or full mode display some fields that may not appear in some other view mode, or vice versa. For a paragraph, for instance, I might have a drop-down field to select a view mode on one display but not have that field on another display.
To me it makes sense to do the opposite, get rid of Full and keep Default. I have rarely ever enabled the Full content view mode personally, instead using the Default and creating new view modes as needed for teaser, cards, whatever. Makes more sense to me to have a Default view mode, which is a fallback when no other mode applies and is the “standard view” for that content type.
Comment #18
joachim commentedJust been bitten by this. It's really hard to understand!
$entity_display_repository->getViewModes('node'); returns a list that contains 'full', but not 'default'.
But in the display admin UI, it's called 'default', and the config view display is called 'node.BUNDLE.default'.
But the CSS class on the viewed node says 'full' and the view mode in hook_entity_display_build_alter() is 'full'.
So... I think what's happening is that the 'full' mode is being requested, but that's not enabled, i.e. the 'full' view mode's status is 'false', which means in the admin UI it's not set to have custom display settings. So 'default' is being used as a fallback, but it's being presented *as if it were 'full', hence the CSS class and the view mode in hook_entity_display_build_alter().
Comment #19
geek-merlin@joachim: Like the IS states, and just like in Views, 'default' is the universal fallback:
Maybe it's mori intuitive UI-wise in views than in field UI. Also, there's maybe more use for this in a complex view.
I like the proposal from the IS, but it'll be quite a deprecation and update dance.
Comment #20
lauriiiI was working on #3483304 and realized there's overlap with this issue. I don't think we should introduce the concept of locked view modes. For micro-content we'd want users to be able to delete the Full view mode entirely.
Given that, here's a proposal:
1. Copy "Default" display to "Full" display for existing sites
For BC, provide an update hook that copies
core.entity_view_display.*.defaultconfigs to*.fullwhen a Full display doesn't already exist.2. Stop creating "Default" display for new content types
New content types would only get a "Full" display — no "Default" at all. This means new sites and new content types are immediately on the new structure with no legacy baggage.
3. Make "Default" display deletable
Allow existing sites to delete their "Default" displays once they've confirmed it's no longer being used. This lets sites migrate at their own pace.
4. Introduce internal fallback rendering (code-only, not config)
When a requested view mode has no "Default" display, render a warning message with a link to create/enable the missing view mode. This is purely code (i.e. no config entity, no view mode in dropdowns or exports).
Something like:
With these changes, deprecation would look like this:
Comment #22
mortona2k commentedUpdated summary with additional context about how it works and where the confusion is.
I think we should keep default and full. Full works for the main content display, and Default is for undefined displays that are configured or hardcoded. What if overrides worked similar to views displays, where field config could be inherited or overridden?
Keep it - let's us configure defaults instead of a derived fallback and is copied for new displays.
This could lead to mistakes without some assistance to help you configure missing displays.
Consolidate and standardize existing ones.
How about better syncing of field settings instead? For example, an option on the field add form to add it to displays. Or an option to reset a display's field settings to default or another display?
Standardizing the Full/main display name would help, and inheriting field settings from Default.
We can just not enable the full display, and it falls back to default.
Fallback order needs to be clarified to site builders, and the hardcoded uses seem tangled.
Unsure if you mean the display mode settings are clearer in views UI, or the way views display overrides work.
Views UI settings list all display modes, so it can be very confusing to configure.
I think this all still fits if we make default deletable and add a fallback. The Default display can be deleted already, but the pseudo display mode remains in the UI.
Does removing default improve the UX? We are forced to specify display modes or get a fallback, but there is no way to set defaults for new displays. Consider if default display settings could be inherited in other displays.
Can we add more context to where the display modes are selected to help avoid misconfiguration, and a message or status report for missing displays?