Problem/Motivation

When enabling the module and layout_builder at the same time, a fatal error is created:

When fixed we should add layout_builder to the list of auto-enable modules.

Steps to reproduce

- Launch new "try online" gitpod
- ddev drush en lupus_decoupled_layout_builder -y

see error

In EntityTypeRepository.php line 111:
                                                                                                                
  The Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay class does not correspond to an entity type.  
                                                                                                                
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

Issue summary: View changes
roderik’s picture

Minimum modules required to trigger the error on my ddev instance:

Note, no lupus_decoupled modules are involved:

$ drush si
$ drush en -y custom_elements
 [success] Successfully installed: custom_elements
$ drush en -y layout_builder
The following module(s) will be installed: layout_builder, layout_discovery


In EntityTypeRepository.php line 111:

  The Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay class does not correspond to an enti
  ty type.

So this seems a custom_elements bug, and feels related to the fact that we are 'unlinking' the LayoutBuilderEntityViewDisplay class:

function custom_elements_entity_type_alter(array &$entity_types) {
  // Use the right class depending on layout builder being used.
  $class = \Drupal::moduleHandler()->moduleExists('layout_builder') ? CustomElementsLayoutBuilderEntityViewDisplay::class : CustomElementsEntityViewDisplay::class;
  /** @var \Drupal\Core\Entity\EntityTypeInterface[] $entity_types */
  $entity_types['entity_view_display']
    ->setClass($class);
}

I will trace this and add a custom_elements issue today.

The error looks bad but it seems not to do anything. I find nothing in the status report, no strange behavior.

roderik’s picture

Fix in #3504944: Error enabling layout_builder. If you approve that issue + want, I can release custom_elements 3.0.2 tomorrow, and add a MR here that depends on that minimum version.

fago’s picture

Status: Active » Needs review

The fix works! Let's also auto-enable layout builder and mere this MR when the CE release is out.

roderik changed the visibility of the branch 3504718- to hidden.

roderik changed the visibility of the branch 3504718- to active.

roderik’s picture

CE release is out; requirement added to composer.json. Build is green.

Note this is a new "require" line because previously, we depended on custom_elements only indirectly through lupus_ce_renderer..

I was tempted for a moment to drop support for CE v2, just because we might introduce some functionality later that depends on CE v3 without realizing it.

But 1) that's not up to this specific issue; 2) I can't really think of such functionality (yet; let's see about CE v3.1)

As an aside: the recipes that ship with configuration all require custom_elements v3. But I assume 1) they would error out when trying to install config onCE v2; 2) no new installation will ever install v2 anyway.

  • fago committed 76bcabaf on 1.x
    Issue #3504718 by fago, roderik: Fix error when enabling layout_builder...
fago’s picture

Status: Needs review » Fixed

thanks! recipes should be able to require v3.

Status: Fixed » Closed (fixed)

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