Since there are some issues and comments in other issues regarding the topic of compatibility issues between DS and Field layout core module with more or less good descriptions about it flying around, with some of them hijacked and half fixed, and others reporting to break the site and causing WSOD without a way out, I thought it would be important to start this meta issue and to try detangle all the issues in the mix to solve the compatibility issues between DS and Field Layout.

TL;DR Main motivation for this issue are several hijacks and reports complaining about if Display Suite and Field Layout core module are activated in a certain order causes unrevertable WSOD and there is no way out no more to disable the Field Layout before Display Suite.

List of possible related issues or issue comments in them to fix:

  1. #2897810: Some fields are not shown when DS used with Field Layout core module
  2. #2878716: field_layout conflict with ds module
  3. #2795833: [plan] Add layouts to entity displays (both form and view)

EDIT: As stated in the comments many sites already seem to work flawless with both modules activated now but we do not know yet, if the order makes the difference. aspilicious moved this issue to core and gave some interesting insides for patching.

In case if this still hits you, it seems you can only solve this by disabling a module which is used to manage field and node view displays and which makes itself very mandatory when started to use. So this issue becomes slidely tricky in case if you have 70% finished your manage display settings with DS in your project and accidently activate the Layout Plugin module, you maybe loose all the work of a week if there is still something going on. In D8 you do not disable modules no more, you uninstall them. The chance that the settings are lost, is high. Additionally, in D8, the "way to view" content becomes more and more relevant regarding content relations and referencing (context). Without corresponding back references (not default in D8 references) many content is "lost in translation". This means, content can loose context when the display of it connected to other content is broken.

After Dries' great and encouraging keynote regarding the future of Layout API and its modules in core, many will possibly fall into this trap and we should warn them. He clearly states, that it is about D 8.5 and higher but many will think of a 50/50 chance to test the experimental modules already on early stage now below. I strongly recommend to put something in the respective project pages and docs until this issues are fixed.

Maybe useful comments from a hijacked issue fitting to the gathering point: #4, #5, #6, #7

CommentFileSizeAuthor
#10 2931226-9.patch611 bytesgambry

Comments

diqidoq created an issue. See original summary.

dqd’s picture

Issue summary: View changes
dqd’s picture

dqd’s picture

Issue summary: View changes
dqd’s picture

Issue summary: View changes
FrenchRoasted’s picture

I received a version of this bug while in 8.5.1 core. I had Display Suite installed. I installed Field Layout.
Then I could not get to several admin views. I tried to back out by uninstalling Field Layout. Which died with the same error. So then I uninstalled Display Suite. That let me back in to admin/config/people/accounts, but I still can't uninstall Field Layout. Error log shows instances of this error for each action that I was unable to complete:
TypeError: Argument 1 passed to {closure}() must implement interface Drupal\field_layout\Display\EntityDisplayWithLayoutInterface, instance of Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay given in {closure}() (line 34 of /srv/bindings/222579ed6ff54e7da2207cfdbfb903eb/code/core/modules/field_layout/field_layout.install)

aspilicious’s picture

Field layout and DS works perfectly on a lot of sites these days.
Are you sure you're on the correct branch and run update.php?

aspilicious’s picture

Status: Active » Postponed (maintainer needs more info)
gambry’s picture

Status: Postponed (maintainer needs more info) » Needs work

If DS is installed before Field Layout, installing the latter cause the error in #6, both in drush and from the Extend UI.

I believe the test is not failing because by installing them together the module_installer sort the array putting field_layout before ds and so not triggering the bug.

I'm trying to validate this theory.

gambry’s picture

Status: Needs work » Needs review
StatusFileSize
new611 bytes

Yep, it does fail locally if not installed together with the other modules.

Status: Needs review » Needs work

The last submitted patch, 10: 2931226-9.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

gambry’s picture

Issue tags: +DevDaysLisbon
aspilicious’s picture

I think this is a core bug in field_layout.install

/**
 * Implements hook_install().
 */
function field_layout_install() {
  // Ensure each entity display has a layout.
  $entity_save = function (EntityDisplayWithLayoutInterface $entity) {
    $entity->ensureLayout()->save();
  };
  array_map($entity_save, EntityViewDisplay::loadMultiple());
  array_map($entity_save, EntityFormDisplay::loadMultiple());

  // Invalidate the render cache since all content will now have a layout.
  Cache::invalidateTags(['rendered']);
}

The code assumes every EntityViewDisplay extends EntityDisplayWithLayoutInterface. This is not the case when DS is installed first.

And it's caused by:

/**
 * Implements hook_entity_type_alter().
 */
function ds_entity_type_alter(array &$entity_types) {
  // Undo field_layout changes to EntityViewDisplay.
  if (\Drupal::moduleHandler()->moduleExists('field_layout')) {
    $entity_types['entity_view_display']->setClass($entity_types['entity_view_display']->getOriginalClass());
    if (\Drupal::moduleHandler()->moduleExists('field_ui')) {
      $entity_types['entity_view_display']->setFormClass('edit', 'Drupal\field_ui\Form\EntityViewDisplayEditForm');
    }
  }
}
aspilicious’s picture

Title: [meta] Enabling core Field layout module with DS causes critical issues » Enabling core Field layout module fatals during installation
Project: Display Suite » Drupal core
Version: 8.x-3.x-dev » 8.6.x-dev
Component: Code » field_layout.module
Priority: Critical » Normal

Moving to the Drupal core queue.

dqd’s picture

Issue summary: View changes
Issue tags: +needs patch

I'll update the issue summary since it has too much "drama" for what it turned out to be. :) But... Great finding by the way! @aspilicious++

I added +Needs patch

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Status: Needs work » Postponed (maintainer needs more info)
Issue tags: +Bug Smash Initiative

Is this reproducible on a supported version of Drupal?

I gather that you get an error if ds is installed and then you enable the field layout module. If that is correct then I could not reproduce this on Drupal 10.0.x. Since I am not sure if that is the correct steps to cause the error I am changing the status to PMNMI to see if this is still a problem.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Since there hasn't been a follow up to #24 going to close for now.

If still a bug please reopen.

Thanks!

quietone’s picture

Issue tags: -needs patch

Updating tags per Issue tags field and Issue tags -- special tags and for issue #3565085: Drupal core issue tag cleanup.

There are only 3 issues in core using 'needs patch', which isn't very useful on closed issues.