Incompatible with Layout Builder Library

Created on 6 May 2021, over 4 years ago
Updated 23 July 2025, 3 months ago

Problem/Motivation

The Layout Builder Library module is a useful module to allow editors to choose among predefined layouts, instead of given them full control to completely customize layouts. Unfortunately, if Gin Layout Builder is enabled, then Layout Builder Library is unable to function.

Here is the error that was logged:

Notice: Undefined index: #weight in gin_lb_form_alter() (line 303 of /Users/martin/Sites/search/web/modules/contrib/gin_lb/gin_lb.module)
#0 /Users/martin/Sites/search/web/core/includes/bootstrap.inc(305): _drupal_error_handler_real(8, 'Undefined index...', '/Users/martin/S...', 303)
#1 /Users/martin/Sites/search/web/modules/contrib/gin_lb/gin_lb.module(303): _drupal_error_handler(8, 'Undefined index...', '/Users/martin/S...', 303, Array)
#2 /Users/martin/Sites/search/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(539): gin_lb_form_alter(Array, Object(Drupal\Core\Form\FormState), 'layout_layout_b...')
#3 /Users/martin/Sites/search/web/core/lib/Drupal/Core/Form/FormBuilder.php(836): Drupal\Core\Extension\ModuleHandler->alter('form', Array, Object(Drupal\Core\Form\FormState), 'layout_layout_b...')
#4 /Users/martin/Sites/search/web/core/lib/Drupal/Core/Form/FormBuilder.php(279): Drupal\Core\Form\FormBuilder->prepareForm('layout_layout_b...', Array, Object(Drupal\Core\Form\FormState))
#5 /Users/martin/Sites/search/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\layout_library\Form\LayoutBuilderForm), Object(Drupal\Core\Form\FormState))
#6 /Users/martin/Sites/search/web/core/modules/layout_builder/src/Controller/LayoutBuilderHtmlEntityFormController.php(39): Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
#7 [internal function]: Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
#8 /Users/martin/Sites/search/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#9 /Users/martin/Sites/search/web/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#10 /Users/martin/Sites/search/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#11 /Users/martin/Sites/search/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#12 /Users/martin/Sites/search/vendor/symfony/http-kernel/HttpKernel.php(158): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#13 /Users/martin/Sites/search/vendor/symfony/http-kernel/HttpKernel.php(80): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#14 /Users/martin/Sites/search/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#15 /Users/martin/Sites/search/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#16 /Users/martin/Sites/search/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#17 /Users/martin/Sites/search/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#18 /Users/martin/Sites/search/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#19 /Users/martin/Sites/search/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#20 /Users/martin/Sites/search/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 /Users/martin/Sites/search/web/core/lib/Drupal/Core/DrupalKernel.php(706): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 /Users/martin/Sites/search/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#23 {main}

Steps to reproduce

  • Install Drupal 9.1.8 with Gin, Gin Layout Builder, and Layout Builder Library
  • Enable Gin and the modules
  • Go to http://search.dev.localhost/admin/structure/layouts/add and create a new layout for one of the content types
  • Click save to submit
  • The error will appear as an overlay on the next page, where there should be a Layout Builder interface with a default section shown:

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇨🇦Canada mandclu

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024