I'm using Panels/Page Manager to create a custom landing page. The layout can be used by both Panels and Display Suite (Using Layout Plugin). I'm getting an error on Page Manager pages that seem to be caused by Display Suite.

Notice: Undefined index: #bundle in ds_preprocess_ds_layout() (line 343 of modules\ds\ds.module).
ds_preprocess_ds_layout(Array, 'col_homepage', Array) (Line: 287)
Drupal\Core\Theme\ThemeManager->render('col_homepage', Array) (Line: 435)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 226)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 574)
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) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62)
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: 98)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 77)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 628)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

One solution is to remove the: class: '\Drupal\ds\Plugin\DsLayout' in the custom Layout Plugin layout.

col_card_one:
  label: Card One
  category: Test Category
  path: templates/layouts/col_card_one
  class: '\Drupal\ds\Plugin\DsLayout'
  template: col_card_one
  icon: col_event.png
  css: cardone.css
  regions:

Another Solution is to comment out Line 343 in ds/ds.module. $bundle = $variables['content']['#bundle'];
My assumption is that the second solution is possibly incorrect, lol.

 * This function is added in ds_theme_registry_alter().
 */
function ds_preprocess_ds_layout(&$variables) {
  $layout_settings = $variables['settings'];

  // Fetch the entity type.
  $bundle = FALSE;
  $entity_type = FALSE;
  if (isset($variables['content']['#entity_type'])) {
    $entity_type = $variables['content']['#entity_type'];
    $bundle = $variables['content']['#bundle'];
  }

I only noticed this issue when i upgraded to Display Suite 8.x-2.5.....
Display Suite 8.x.2.4 does not show this notice.

Code Comparison
DS 8.x.2.5

// Fetch the entity type.
  $bundle = FALSE;
  $entity_type = FALSE;
  if (isset($variables['content']['#entity_type'])) {
    $entity_type = $variables['content']['#entity_type'];
    $bundle = $variables['content']['#bundle'];
  }

DS 8.x.2.4

  // Fetch the entity type.
  if (isset($variables['content']['#entity_type'])) {
    $entity_type = $variables['content']['#entity_type'];
  }
  else {
    $entity_type = FALSE;
  }

This is most likely not a big deal because i can just create a duplicated layout(Layout Plugin) without the Display Suite Class(class: '\Drupal\ds\Plugin\DsLayout')

MY Environment:
Drupal 8.1.3
Display Suite 8.x-2.5
Layout plugin 8.x-1.0-alpha22
Page Manager 8.x-1.0-alpha23
Panels 8.x-3.0-beta4

CommentFileSizeAuthor
#5 2758909-5.patch415 bytesaspilicious
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gcharles created an issue. See original summary.

aspilicious’s picture

Validatie bug I need to add An additional check if bundel is set. Will do this, this weekend.

gcharles’s picture

Ok, let me know if there is anything i can help with.

aspilicious’s picture

Can you write a test that shows the problem?
Or describe which steps I need to take to reproduce the problem.

aspilicious’s picture

Status: Active » Needs review
FileSize
415 bytes

  • aspilicious committed a16b85d on 8.x-2.x
    Issue #2758909 by aspilicious: Error using Display Suite and Page...
aspilicious’s picture

Status: Needs review » Fixed

This should fix your problem

Status: Fixed » Closed (fixed)

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

Ahmad Abbad’s picture

Patch #5 fixed the issue.

Thank you @aspilicious

aminshamim’s picture