When attempting to use DS in conjunction with Layout Builder, there are competing form values. Layout builder has a $form['layout'] form in it.

I'm currently trying to use Layout builder for entity displays, but I want to retain DS for some of my paragraphs. Also its great to have the flexibility between the two layout options.

Currently my steps to reproduce the issue:
1. use patch https://www.drupal.org/project/drupal/issues/2936358#comment-12589800 to configure layout builder per entity bundle (this might change later)
2. enable layout builder and ds
3. Attempt to save an entity display configuration.

Upon saving there will be several errors that all stem from using the same name for input.

Suggested: namespace the form values. Its a simple solution that would probably be an ideal thing regardless of the implications of Layout Builder.

Suggested patch will come in following comment.

Comments

pookmish created an issue. See original summary.

pookmish’s picture

pookmish’s picture

Status: Active » Needs review
pookmish’s picture

StatusFileSize
new2.66 KB

re-rolling patch for disabling layout builder on a bundle.

Status: Needs review » Needs work

The last submitted patch, 4: 2966959-ds-namespace_form_for_layout_builder-4.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

abu-zakham’s picture

Status: Needs work » Needs review
m.abdulqader’s picture

+1

swentel’s picture

Priority: Normal » Critical
Status: Needs review » Needs work

Raising to critical as I also experienced the problem and it makes saving the manage display not workable at all.

Patch fixes the error, but it looks like the tests don't pass, so we we need to make sure everything still works of course.

swentel’s picture

Status: Needs work » Needs review
StatusFileSize
new13.57 KB

Let's see what this does.

Status: Needs review » Needs work

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

swentel’s picture

Status: Needs work » Needs review
StatusFileSize
new14.21 KB

fix assert in clonetest

Status: Needs review » Needs work

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

swentel’s picture

Status: Needs work » Needs review
StatusFileSize
new14.6 KB

I'm a moron.

Also enabled layout builder in all tests so we know for sure nothing gets in the way.

Status: Needs review » Needs work

The last submitted patch, 13: 2966959-12.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

swentel’s picture

Status: Needs work » Needs review
StatusFileSize
new14.21 KB

Interesting. Let's see if everything is fine without enabling layout_builder.

I would also argue that we drop the test for Field Layout, that module is pretty much obsolete anyway.

swentel’s picture

StatusFileSize
new14.6 KB

Ok, now again with layout_builder enabled.

Looks like field layout won't be gone yet, so keeping that one as well.

swentel’s picture

Note, field layout problem might be related to #2931226: Enabling core Field layout module fatals during installation

Status: Needs review » Needs work

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

swentel’s picture

Status: Needs work » Needs review

Ok the other failure is because of layout_builder_entity_view_alter() remove our extra fields which are added in hook_entity_view().

I'd argue that this is a bug in layout builder as it should check whether the entity that is being rendered is actually using a layout builder configuration. That should speed up everything too imo.

m.abdulqader’s picture

Thanks for the patch, I applied the patch on last dev version and its work for the first save, after that if I save the display I get this error

Error: Cannot use string offset as an array in /modules/contrib/ds/includes/field_ui.inc on line 371 #0 [internal function]: ds_field_ui_layouts_save(Array, Object(Drupal\Core\Form\FormState))

swentel’s picture

StatusFileSize
new15.12 KB

Hmm, yeah, we're getting this too now, in combination with layout builder restrictions module.

New patch attached which fixes that.

Status: Needs review » Needs work

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

abu-zakham’s picture

Status: Needs work » Needs review
andypost’s picture

It sounds like new major version should be released cos form structure changes

+++ b/tests/src/Functional/TestBase.php
@@ -38,6 +38,7 @@ abstract class TestBase extends BrowserTestBase {
+    'layout_builder',

does it makes sense to enable the module for all tests?

tim.plunkett’s picture

Status: Needs review » Needs work
swentel’s picture

Priority: Critical » Normal

Committed the patch without the layout_builder tests enabled.

It sounds like new major version should be released cos form structure changes

That seems a bit to disruptive. Core doesn't follow that practice either, so not bumping for now. Not many modules alter back on the form after DS has done it's stuff, so I think we're fine here.

Raising to normal to keep track of #2993298: layout_builder_entity_view_alter() should check whether layout builder configuration is used - once that is in, we need to add a test with layout builder enabled.

  • swentel committed 3c7464d on 8.x-3.x
    Issue #2966959 by swentel, pookmish, abu-zakham, andypost, tim.plunkett...
swentel’s picture

Status: Needs work » Fixed
swentel’s picture

Actually, created a follow up at #3029785: Add test with layout builder

swentel’s picture

Priority: Normal » Critical

Resetting critical status.

Status: Fixed » Closed (fixed)

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