Problem/Motivation
Default vs. Full is weird, there are a number of issues around that and the main problem is that getViewModeOptionsByBundle() and related methods return wrong data.
The default view mode is "full", which if not explicitly enabled will then fall back to the configuration provided by "Default". But the $view_mode argument *is* full.
One example where this breaks is if you have a node--$type--full.html.twig template, but the preview doesn't use that.
Proposed resolution
Changing those methods is hard, especially in 8.x. The patch that I will attach proposes a very simply workaround, we simply add Full sa the first option in the list, always.
Comments
Comment #2
BerdirComment #3
BerdirWe also need to set the default to full. Not sure if we should remove default completely or not. IMHO yes.
Comment #5
BerdirUpdated the tests. Seems to me we don't really need additional test coverage if we agree that this change makes sense conceptually. And I really think so :)
Comment #7
BerdirSame random test fail.
Comment #8
claudiu.cristeaHm, at least for me now looks more confusing having both "Full" and "Default" in the dropdown list. I have to confess that it took me a while in the past to familiarize with the difference between Default and Full.
Comment #9
swentel CreditAttribution: swentel as a volunteer commentedMakes sense to me.
Comment #10
BerdirRe full vs default. I'd be happy to remove default completely but I wasn't sure about whether that is an OK change, especially for a patch release. But I'd be OK to remove default and only get it into 8.3.x in turn.
This will definitely fail/conflict now on 8.3.x now, though.
Also, I plan to open an issue to make sense of the default/full/fallback confusion in general, but pretty sure that is 9.x material.
Comment #12
BerdirReroll for 8.3.x, updated tests and completely removing "Default" as suggested in #10 that might be OK for an 8.3 only patch.
Comment #13
claudiu.cristeaLooks good. Just a very minor nit
FormBase
is already using theStringTranslationTrait
, so$this->t()
is available. s/t()/$this->t()Comment #14
BerdirFixed that.
Comment #15
claudiu.cristeaComment #16
alexpottWhat happens when the full mode is deleted? I tried this locally and everything works - it just falls back to default but I'm not sure that adding full makes sense if it doesn't exist.
Comment #17
BerdirEven if you delete* "full", that's still the view mode that is used on node/1.
View mode config entities really only have one purpose, to show up as a checkboxes on "Manage display", so you can enable a display for it. At runtime, the view mode is just a string, it is never loaded/validated or anything.
* Yes, you probably shouldn't be able to delete that, but that's another story. I also plan to create a follow-up issue to bring sense into the whole default/full view mode/view display mess.
Comment #18
alexpottCommitted and pushed 959df8d to 8.3.x and 333a973 to 8.2.x. Thanks!
Discussed with @Berdir in IRC and we decided that this makes things better since as @Berdir wrote:
Comment #21
BerdirOpened #2844203: Improve/Simplify situation around Default/Full view modes/view displays as a follow-up to discuss this further.