Problem/Motivation

Today, display_builder use the same mechanism as layout_builder to replace Manage Display.

However, when is activated, it hides the availability of the other.

Proposed resolution

Make sure Layout Builder & Dispaly Builder are both usable in a same Drupal website (but not in the same display of course).

If not possible to do something clean, agnostic, just acknowledge the availability of Layout Builder and propose to switch between each one and the regular manage display.

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

pdureau created an issue. See original summary.

pdureau’s picture

Grimreaper has a way of making them both available in a single display (we can only pick one, but both are available)

But, on the display rendering side, if we pick DB, LB is coming after and load Manage Display instead.

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

grimreaper’s picture

Status: Active » Needs work

Inspired by https://www.drupal.org/project/entity_vdts

To add form element on the entity view display form when Layout Builder is enabled is OK.

But we have not found yet how to take the hand on the rendering and provide a link to the Display Builder on the entity view display form.

grimreaper’s picture

With proposed changes, Display Builder override Layout Builder.

Now we need to check if Layout Builder is present to call it too or not. Because not possible to enable Layout Builder on a view display anymore.

mogtofu33’s picture

pdureau’s picture

Title: [1.0.0-alpha2] Play nice with layout builder » Play nice with layout builder
Issue tags: -display_builder-1.0.0-alpha2 +display_builder-1.0.0-alpha3
grimreaper’s picture

As discussed, currently for a first compatibility, let's assume layout_builder is present and add it as a dependency so we can extend it to fallback to its behavior.

grimreaper’s picture

Status: Needs work » Needs review

POC working \o/

grimreaper’s picture

Assigned: grimreaper » Unassigned

MR ready for test and discussions.

override per content was not handled or I missed that?

pdureau’s picture

override per content was not handled or I missed that?

Planned for Alpha3: #3529125: Add content display overrides

pdureau’s picture

Assigned: Unassigned » mogtofu33

pdureau’s picture

mogtofu33’s picture

Looking good, thanks!
Added a message when both are enabled, because of layout destruction on deletion it make sense to allow both to avoid loosing the layout.
Had an error on enabled but seems from my env, will double check and merge if ok.

mogtofu33’s picture

Status: Needs review » Needs work

Message fixed.

I have a problem from a clean install, all caches ON, no dev only verbose error logging:

  • Layout builder is NOT enabled
  • Go to ui modules list and enable display_builder_entity_view
  • Accept other modules including layout builder
  • Submit, error appear:

Drupal\Core\Entity\Exception\NoCorrespondingEntityClassException: The Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay class does not correspond to an entity type. in Drupal\Core\Entity\EntityTypeRepository->getEntityTypeFromClass() (line 111 of core/lib/Drupal/Core/Entity/EntityTypeRepository.php).

This makes the display_builder config to not be installed properly (missing config default) and add some failing on the display of entity.

Do we have a way to ensure layout_builder is enabled before? perhaps with a dependencies?

christian.wiedemann’s picture

Or maybe we have two modules. The current entity_view module and a entity_view_lb which disables the entity_view module and vice verse with the code from the mr?

grimreaper’s picture

Strange because I have added layout_builder as a dependency.

I will try to reinstall with MR applied before install.

grimreaper’s picture

Assigned: mogtofu33 » grimreaper

I also have the error, I will try to debug after a meeting.

grimreaper’s picture

The problem is from

function layout_builder_install(): void {
  $display_changed = FALSE;

  $displays = LayoutBuilderEntityViewDisplay::loadMultiple();

It is trying to load from the class but at this moment entity_view_display class had already been overridden by display_builder_entity_view and so EntityTypeRepository does not find "entity_view_display" from the class LayoutBuilderEntityViewDisplay.

I will try to see if changing core a little bit will help.

grimreaper’s picture

  $displays = \Drupal::entityTypeManager()->getStorage('entity_view_display')->loadMultiple();

fixes the issue

I will search for an existing core issue and/or create a new one if needed.

grimreaper’s picture

Assigned: grimreaper » Unassigned
Status: Needs work » Needs review
pdureau’s picture

Assigned: Unassigned » mogtofu33
mogtofu33’s picture

Assigned: mogtofu33 » Unassigned
Status: Needs review » Fixed
grimreaper’s picture

I don't see any commit related to this issue on 1.0.x.

Has it been merged?

pdureau’s picture

pdureau’s picture

Status: Fixed » Closed (fixed)
grimreaper’s picture

Hi,

2 points.

- Git: you can edit the default commit message in Gitlab UI, When checking the "Combine (squash) commits", there is a "Edit commit message" checkbox. Mentioning that because even if I was the commit author, I am not in the commit message, that's a detail.

- I think this may had been committed too soon, maybe we should have documented the core issue and the need to apply a patch.