I am on Version: 3.6.0 with this patch https://www.drupal.org/project/ds/issues/3137198 but this problem was on Version 3.5.0 as well.

1. Created a fresh Content Type
2. Set the Content Type to use Layout Builder
3. Created a node of that Content Type and edited the Layout
4. Added a section. Chose one of the layouts provided by Display Suite.
5. Under Custom Wrappers, added role|navigation under Layout Attributes.
6. Added a Basic Block to the section.
7. Saved the layout.

There was this error at the top of the page, and the attribute did not appear in the HTML.

Notice: Undefined index: #entity_type in ds_preprocess_ds_layout() (line 525 of modules/contrib/ds/ds.module).
ds_preprocess_ds_layout(Array, 'ds_2col', Array) (Line: 287)
Drupal\Core\Theme\ThemeManager->render('ds_2col', Array) (Line: 431)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 444)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 444)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 444)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 444)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 444)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 200)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 226)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 227)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 156)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

(There was a second one because it was a two-column layout.)

Notice: Undefined index: # in ds_preprocess_ds_layout() (line 525 of modules/contrib/ds/ds.module).
ds_preprocess_ds_layout(Array, 'ds_2col', Array) (Line: 287)
Drupal\Core\Theme\ThemeManager->render('ds_2col', Array) (Line: 431)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 444)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 444)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 444)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 444)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 444)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 200)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 226)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 227)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 156)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

We're going to need to be adding attributes on these sections, so hopefully this can be fixed. It's a great feature.

CommentFileSizeAuthor
#5 3139230-5.patch656 bytesswentel
#2 ds-3139230.png42.19 KBswentel
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sacarney created an issue. See original summary.

swentel’s picture

FileSize
42.19 KB

Hmm, I just tried this with the latest version #3137198: Token prevents layout builder to add new ds layout committed and this works great, see screenshot.

Tested this with default layout and override on a node.

So not sure exactly why you get the errors.

swentel’s picture

Status: Active » Closed (cannot reproduce)

Tested this again with latest release (with one commit as well adding even better support for ds and layout builder, but that one should not affect this). Still can't reproduce and works fine.

swentel’s picture

Status: Closed (cannot reproduce) » Active

Actually, I do see errors appearing in the logs, even though the attribute is printed, reopening.

swentel’s picture

Status: Active » Needs review
FileSize
656 bytes

This fixes the notice

  • swentel committed 3d491da on 8.x-3.x
    Issue #3139230 by swentel: Unable to add attributes to Display Suite...

  • swentel committed 6156d38 on 8.x-4.x
    Issue #3139230 by swentel: Unable to add attributes to Display Suite...
swentel’s picture

Status: Needs review » Fixed

committed and pushed!

Status: Fixed » Closed (fixed)

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