Live Preview has issues with Media Background

Created on 15 February 2023, almost 2 years ago
Updated 27 September 2023, about 1 year ago

Problem/Motivation

After the latest update with the Live preview enabled when attempting to add a Background Image to a new section I am getting this error

TypeError: Illegal offset type in Drupal\Core\Entity\EntityStorageBase->load() from 
docroot/modules/contrib/bootstrap_styles/src/Plugin/BootstrapStyles/Style/BackgroundMedia.php(384): Drupal\Core\Entity\EntityBase::load(Array)

Steps to reproduce

  1. Create a basic page
  2. Click layout
  3. Add a 1 column section
  4. Add a Background image
  5. Try to hit save section

This only happens on New nodes created.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇺🇸United States emerham

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

Comments & Activities

  • Issue created by @emerham
  • 🇺🇸United States emerham

    Full stack trace

    TypeError: Illegal offset type in Drupal\Core\Entity\EntityStorageBase->load() (line 297 of /var/www/html/docroot/core/lib/Drupal/Core/Entity/EntityStorageBase.php)
    #0 /var/www/html/docroot/core/lib/Drupal/Core/Entity/EntityBase.php(488): Drupal\Core\Entity\EntityStorageBase->load(Array)
    #1 /var/www/html/docroot/modules/contrib/bootstrap_styles/src/Plugin/BootstrapStyles/Style/BackgroundMedia.php(384): Drupal\Core\Entity\EntityBase::load(Array)
    #2 /var/www/html/docroot/modules/contrib/bootstrap_styles/src/StylesGroup/StylesGroupManager.php(265): Drupal\bootstrap_styles\Plugin\BootstrapStyles\Style\BackgroundMedia->build(Array, Array, 'blb_container_w...')
    #3 /var/www/html/docroot/modules/contrib/bootstrap_layout_builder/src/Plugin/Layout/BootstrapLayout.php(166): Drupal\bootstrap_styles\StylesGroup\StylesGroupManager->buildStyles(Array, Array, 'blb_container_w...')
    #4 /var/www/html/docroot/core/modules/layout_builder/src/Section.php(98): Drupal\bootstrap_layout_builder\Plugin\Layout\BootstrapLayout->build(Array)
    #5 /var/www/html/docroot/core/modules/layout_builder/src/Element/LayoutBuilder.php(240): Drupal\layout_builder\Section->toRenderArray(Array, true)
    #6 /var/www/html/docroot/core/modules/layout_builder/src/Element/LayoutBuilder.php(124): Drupal\layout_builder\Element\LayoutBuilder->buildAdministrativeSection(Object(Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage), 0)
    #7 /var/www/html/docroot/core/modules/layout_builder/src/Element/LayoutBuilder.php(98): Drupal\layout_builder\Element\LayoutBuilder->layout(Object(Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage))
    #8 [internal function]: Drupal\layout_builder\Element\LayoutBuilder->preRender(Array)
    #9 /var/www/html/docroot/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(101): call_user_func_array(Array, Array)
    #10 /var/www/html/docroot/core/lib/Drupal/Core/Render/Renderer.php(788): Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_ren...', 'exception', 'Drupal\\Core\\Ren...')
    #11 /var/www/html/docroot/core/lib/Drupal/Core/Render/Renderer.php(374): Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array)
    #12 /var/www/html/docroot/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender(Array, true)
    #13 /var/www/html/docroot/core/lib/Drupal/Core/Render/Renderer.php(148): Drupal\Core\Render\Renderer->render(Array, true)
    #14 /var/www/html/docroot/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}()
    #15 /var/www/html/docroot/core/lib/Drupal/Core/Render/Renderer.php(149): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
    #16 /var/www/html/docroot/core/lib/Drupal/Core/Ajax/CommandWithAttachedAssetsTrait.php(36): Drupal\Core\Render\Renderer->renderRoot(Array)
    #17 /var/www/html/docroot/core/lib/Drupal/Core/Ajax/ReplaceCommand.php(31): Drupal\Core\Ajax\InsertCommand->getRenderedContent()
    #18 /var/www/html/docroot/core/lib/Drupal/Core/Ajax/AjaxResponse.php(43): Drupal\Core\Ajax\ReplaceCommand->render()
    #19 /var/www/html/docroot/modules/contrib/bootstrap_layout_builder/src/Plugin/Layout/BootstrapLayout.php(575): Drupal\Core\Ajax\AjaxResponse->addCommand(Object(Drupal\Core\Ajax\ReplaceCommand))
    #20 [internal function]: Drupal\bootstrap_layout_builder\Plugin\Layout\BootstrapLayout->livePreviewCallback(Array, Object(Drupal\Core\Form\FormState), Object(Symfony\Component\HttpFoundation\Request))
    #21 /var/www/html/docroot/core/lib/Drupal/Core/Form/FormAjaxResponseBuilder.php(69): call_user_func_array(Array, Array)
    #22 /var/www/html/docroot/core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php(109): Drupal\Core\Form\FormAjaxResponseBuilder->buildResponse(Object(Symfony\Component\HttpFoundation\Request), Array, Object(Drupal\Core\Form\FormState), Array)
    #23 [internal function]: Drupal\Core\Form\EventSubscriber\FormAjaxSubscriber->onException(Object(Symfony\Component\HttpKernel\Event\ExceptionEvent), 'kernel.exceptio...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
    #24 /var/www/html/docroot/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\ExceptionEvent), 'kernel.exceptio...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
    #25 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(229): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Symfony\Component\HttpKernel\Event\ExceptionEvent), 'kernel.exceptio...')
    #26 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(92): Symfony\Component\HttpKernel\HttpKernel->handleThrowable(Object(Drupal\Core\Form\FormAjaxException), Object(Symfony\Component\HttpFoundation\Request), 1)
    #27 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #28 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #29 /var/www/html/docroot/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #30 /var/www/html/docroot/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #31 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #32 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #33 /var/www/html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #34 /var/www/html/docroot/core/lib/Drupal/Core/DrupalKernel.php(713): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #35 /var/www/html/docroot/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
    #36 {main}
  • 🇮🇹Italy drp_distruptor Neaples

    Same issue that seems to be related to Bootstrap Styles ^1.1 ;
    this patch can help!

  • 🇺🇸United States yospyn

    Confirming this patch worked for me, very helpful thanks! Not sure if it's related, but in order to edit the section afterward I also needed to apply this patch for media_library_form_element 🐛 Deprecated function: explode(): Passing null to parameter #2 ($string) of type string is deprecated Fixed . Otherwise clicking "Configure" did not bring up the dialog overlay.

  • 🇮🇹Italy drp_distruptor Neaples

    Yes, I confirm that what @yospyn said is correct. I personally applied the patch reported in the #4 🐛 Live Preview has issues with Media Background Fixed comment.

  • Status changed to Fixed about 1 year ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024