Problem 1: Empty layout option, selecting it causes error message
I have installed a vanilla 8.7.1, no other contrib modules aside Display Suite. When enabling Display Suite and accessing the structure/menu/main/manage display link, on the Layout for main in default tab, the Select layout combo contains the the drupal defined layouts plus the Display Suite ones.
After enabling the Layout Builder from core, clearing the cache and going to the same page, the combo contains one more option after the Display Suite ones under the name of Others, with no text displayed. If one selects that option, an error message appears: An illegal choice has been detected. Please contact the administrator.
Please see the attached photos.
This new option that appears in the list could be an error from the Layout Builder, but if you know that the 'other' option is illegal, maybe it shouldn't appear in the combo.
Problem 2: Display Suite layout is still active after enabling Layout Builder
When enabling Layout Builder for a view mode already using Display Suite for layout, the layout setting for Display Suite still stays active and Layout Builder won't work as expected. One must first select - None - for layout and save the settings before enabling Layout Builder. Not knowing this can cause confusion.
Comment | File | Size | Author |
---|---|---|---|
#20 | 3054607-20.patch | 728 bytes | Joe Huggans |
#12 | 3054607-12.patch | 850 bytes | swentel |
#5 | 3054607-5.patch | 1.67 KB | swentel |
#4 | 3054607-4.patch | 647 bytes | swentel |
Only DS Enabled 1.png | 15.49 KB | devarch |
Comments
Comment #2
aleksipCan confirm the same results with vanilla 8.8.0-dev and Display Suite 3.3.
Comment #3
aleksipAdded another problem description as requested by @swentel in #3076819: Display Suite layout is still active after enabling Layout Builder.
Comment #4
swentel CreditAttribution: swentel commentedThis fixes the blank option
Comment #5
swentel CreditAttribution: swentel commentedAnd this resets ds layouts when you enable layout builder. it also hides the fieldsets which aren't relevant anymore.
Comment #8
swentel CreditAttribution: swentel commentedComment #10
donquixote CreditAttribution: donquixote as a volunteer commentedThis is weird.
The issue was indirectly linked from core issue #3111761: "Error: Call to undefined method Drupal\Core\Entity\Entity\EntityViewDisplay::isLayoutBuilderEnabled()" after 8.7.10 to 8.8.0 update, via #3078617: WSOD upon enable with Layout Builder.
So I thought it would fix the problem reported there.
But the error message from the linked core issue #3111761: "Error: Call to undefined method Drupal\Core\Entity\Entity\EntityViewDisplay::isLayoutBuilderEnabled()" after 8.7.10 to 8.8.0 update looks like it happened with the code change from this issue already in place:
I just had this happen to me.
Perhaps there are specific scenarios where this happens.
The code snippet in question:
I think the safer thing here would be instanceof, like so:
Fyi, you can use instanceof with an unknown class:
https://3v4l.org/FgGoP
So this would still work if layout_builder is not enabled.
Comment #11
swentel CreditAttribution: swentel commentedHmm, makes sense to check on the interface, reopening.
Comment #12
swentel CreditAttribution: swentel commentedShould be fine. Code looks more elegant too :)
Comment #15
swentel CreditAttribution: swentel at eps & kaas commentedcommitted and pushed, added credit too, thanks!
Comment #16
donquixote CreditAttribution: donquixote as a volunteer commentedCool!
Btw with this "early return" pattern, I like to put the comment inside the if(), like so:
This way the comment can be written in plain sentence describing what "is", instead of using a conditional form describing what "would be".
I also wonder if this check should be moved up a bit.
Some of the variables at the top are not really needed for this check.
Or perhaps move it into ds_form_entity_view_display_edit_form_alter()? Not sure. I think we still want the ds_extras modifications to the form even if it is using layout builder.
Comment #18
Joe HuggansI'm still seeing this issue with the latest version of DS 3.7 and Drupal core 8.8, when trying to save a display on a content type or any entity.
Error: Call to undefined method Drupal\Core\Entity\Entity\EntityViewDisplay::isLayoutBuilderEnabled() in ds_field_ui_layouts_save() (line 333 of modules/contrib/ds/includes/field_ui.inc).
I have both DS and Layout builder installed and the previous developer has made it very hard to uninstall any one of them without rebuilding a large part of the website.
Edit: I'm not sure if this will break anything but if I change like 333 of field_ui.inc from
if (\Drupal::moduleHandler()->moduleExists('layout_builder') && $display->isLayoutBuilderEnabled()) {
to
if ($display instanceof LayoutBuilderEnabledInterface && $display->isLayoutBuilderEnabled()) {
This seems to fix the error, but I'm not sure if it is ok or not?
If anyone could let me know I would appreciate it.
Comment #19
swentel CreditAttribution: swentel at eps & kaas commentedCrap, we totally forgot that part. That will indeed fix the fatal error.
Comment #20
Joe HuggansHere is a patch.
Comment #21
swentel CreditAttribution: swentel at eps & kaas commentedlet's see what the bot thinks
Comment #24
swentel CreditAttribution: swentel at eps & kaas for Dropsolid commentedCouldn't reproduce the error myself, but the fix makes sense. committed and pushed, thanks!
Comment #25
swentel CreditAttribution: swentel at eps & kaas for Dropsolid commented