Problem
The module currently has some code and service for auto-generating entity-ce-displays as needed. It turns out, this is not easy get right, since there are no hooks for entity types.
Proposed Solution
Follow the known to work-well solution of core entity-view-displays. The displays are loaded via the EntityDisplayRepository EntityViewDisplay::collectRenderDisplays() which takes care of auto-creating displays when no display is exiting. That way, no auto-creation logic is needed.
This solution, would simplify things quite a bit and would help us to get rid of the service for intializing the config. But it creates one additional problem for EntityCeDisplays:
Backwards compatibility. Currently NO-display-config means BC is active and processing simply applies. With the solution, this would not work any more, since the config would be auto-created in this case.
For solving backwards compatibility, we could add a hidden config-setting in EntityDisplayConfig, what turns on "auto-processing" for the complete entity view mode. When turned on, we can show this in the UI, similar like we show it when Layout-Builder takes over.
(Side note: EntityDisplayRepository is for the display-modes e.g. the view-modes + form-modes -- which are not the entity-view-displays.)
Original report
Update: The behavior seems correct, since the test-module has entity-view-displays that do not render any fields.
Problem/Motivation
When a module like `custom_elements_test_paragraphs` with default config is installed, the generated CE-displays are invalid and contain empty components/content array.
Steps to reproduce
See current work-a-round in \Drupal\custom_elements\CustomElementsConfigGenerator::configExists and \Drupal\Tests\custom_elements\Functional\CustomElementsRenderMarkupTest::setUp - When removing the workarounds there, tests fail because the config is generated empty during install
Issue fork custom_elements-3445132
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
fagoComment #4
roderikI'm going to just start on this -- I have the feeling I'll pick up opinions about BC (that are now vague) along the way and be better able to articulate them after doing a bit of work.
Comment #6
roderikNeeds review for MR 52 == the
Comment #7
fagothx, this seems pretty good already. I dropped a few comments, please take a look!
Comment #9
fagoComment #10
fagoComment #11
roderikComment #12
roderikComment #14
roderikGreen, but I need one more nudge/feedback to be sure I need to fix addCeDisplayContent().
If this is considered "not relevant enough for alpha" I'll be happy to do that afterwards. I'm keeping notes on todos which I can transplant to a new issue:
- KernelTest for old situation (or at least look at that at the same time as: )
- clean up other tests and make sure I understand that the expected output is really as expected ( likely at the same time as converting other processors )
- this addCeDisplayContent() discussion.
- do the UI for this (delayed until after the merge of our-form + our-formBase)
Comment #15
roderikHm. After fixing a dumb bug, it turns out I have changed the tests too much.
Comment #16
fagoon this now
Comment #17
fagook, worked over it - as discussed with going with the semantics of "DISABLED" == not-existing as core does it usually also. Also extended test-coverage for making sure the fallback works correctly.
Comment #18
roderikThanks. Reviewed. No comments.
Comment #20
fagothx, merged!