The modul token prevents in the layout builder to add a new section with display suites layouts. I tested it also on a new installation with the newest versions, got the same problem.

Steps to replicate:
- Download latest Drupal 8
- Install token and Display Suite
- Enable Layout builder on content type
- Use "One column layout",

The browser inspects shows
AjaxError:
An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /layout_builder/configure/section/overrides/node.1/1/ds_1col
StatusText: OK
ResponseText: Error: Call to undefined method Drupal\layout_builder\Form\ConfigureSectionForm::getEntity() in Drupal\ds\Plugin\DsLayout->buildConfigurationForm() (line 127 of /Users/..../Sites/ww-tuts/bs-build-sites/d-bs-build/web/modules/contrib/ds/src/Plugin/DsLayout.php).

As soon as the module token is uninstalled, it is working again.

Debugging:
The issue seems to be here, https://git.drupalcode.org/project/ds/-/blob/8.x-3.x/src/Plugin/DsLayout...

CommentFileSizeAuthor
#13 3137198-13.patch934 bytesswentel
#9 3137198-9.patch877 bytesswentel
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

bksolo created an issue. See original summary.

Berdir’s picture

Status: Active » Postponed (maintainer needs more info)

Check your logs for the actual error message.

Ivan Zugec’s picture

Here's the fatal error:
Error: Call to undefined method Drupal\layout_builder\Form\ConfigureSectionForm::getEntity() in Drupal\ds\Plugin\DsLayout->buildConfigurationForm() (line 127 of ..../bs-build-sites/d-bs-build/web/modules/contrib/ds/src/Plugin/DsLayout.php)

It's this line: https://git.drupalcode.org/project/ds/-/blob/8.x-3.x/src/Plugin/DsLayout... and it's wrapped with if (\Drupal::moduleHandler()->moduleExists('token')) {

I'm thinking it's a Display Suite issue.

Ivan Zugec’s picture

Project: Token » Display Suite
Version: 8.x-1.7 » 8.x-3.x-dev
Ivan Zugec’s picture

Issue summary: View changes
Ivan Zugec’s picture

Issue summary: View changes
Ivan Zugec’s picture

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

Priority: Normal » Major
swentel’s picture

Priority: Major » Critical
Status: Active » Needs review
FileSize
877 bytes

I would actually say it's critical :)

Attached patch fixes it, could be good to have at least one confirmation, then I can commit and push a new release because this one is tricky to figure out.

ropet’s picture

Hey Swentel,

This patch worked for me. Thanks for it :)

Berdir’s picture

You could maybe check the form object against \Drupal\Core\Entity\EntityFormInterface instead of the getEntity() call. That might actually exist but return something unexpected, who knows?

Anonymous’s picture

This patch worked for me, even I get the following error Undefined method 'getEntity'.
{
"resource": "/e:/drupal/drupaltest/web/modules/contrib/ds/src/Plugin/DsLayout.php",
"owner": "_generated_diagnostic_collection_name_#2",
"code": "1013",
"severity": 8,
"message": "Undefined method 'getEntity'.",
"source": "intelephense",
"startLineNumber": 131,
"startColumn": 145,
"endLineNumber": 131,
"endColumn": 154
}

I'm using Visual Studio Code as the editor.
Thanks

swentel’s picture

FileSize
934 bytes

@berdir - yes, ten times more elegant, thanks for the hint!

  • swentel committed 17df878 on 8.x-3.x
    Issue #3137198 by swentel, Berdir: Token prevents layout builder to add...
swentel’s picture

Status: Needs review » Fixed

committed and pushed, thanks!

Status: Fixed » Closed (fixed)

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