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

Command icon 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

fago created an issue. See original summary.

fago’s picture

Title: CE-Config is not correctly auto-generated during module install » Stop auto-generated entity-ce-display config
Category: Bug report » Task
Issue summary: View changes

roderik made their first commit to this issue’s fork.

roderik’s picture

Assigned: Unassigned » roderik

I'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.

roderik’s picture

Status: Active » Needs review

Needs review for MR 52 == the

So far, this is just moving code around (...) Maybe you want to merge this separately, before I do any real changes.

fago’s picture

thx, this seems pretty good already. I dropped a few comments, please take a look!

  • fago committed 91835e02 on 3.x authored by roderik
    Issue #3445132 by roderik: Refactor to move parts from...
fago’s picture

Status: Needs review » Needs work
fago’s picture

Title: Stop auto-generated entity-ce-display config » Stop auto-generating entity-ce-display config
roderik’s picture

Issue summary: View changes
roderik’s picture

Issue summary: View changes

roderik’s picture

Status: Needs work » Needs review

Green, 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)

roderik’s picture

Status: Needs review » Needs work

Hm. After fixing a dumb bug, it turns out I have changed the tests too much.

fago’s picture

Assigned: roderik » fago

on this now

fago’s picture

Status: Needs work » Needs review

ok, 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.

roderik’s picture

Status: Needs review » Reviewed & tested by the community

Thanks. Reviewed. No comments.

  • fago committed 2cdf8918 on 3.x authored by roderik
    Issue #3445132 by roderik, fago: Stop auto-generating entity-ce-display...
fago’s picture

Status: Reviewed & tested by the community » Fixed

thx, merged!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.