Entity Autocomplete element expecting an array, but getting a scalar value for target_id instead

Created on 23 September 2019, almost 5 years ago
Updated 18 June 2024, 3 months ago

When using Layout Builder with a View block display (having configuration parameters added by a patch from #2657060: Add Configure Filter functionality to block views configuration. β†’ ) containing a footer link to a Page display on the same view with matching exposed filters, the linked page expects each filter to be an array containing a target_id key with a numeric ID, but a scalar value is provided instead.

The following error is observed when saving the block configuration in Layout Builder:

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /layout_builder/update/block/overrides/node.XXX/0/content/UUIDv4?destination=/node/XXX/layout&_wrapper_format=drupal_dialog.off_canvas&ajax_form=1
StatusText: parsererror
ResponseText: TypeError: Argument 1 passed to Drupal\Core\Entity\Element\EntityAutocomplete::Drupal\Core\Entity\Element\{closure}() must be of the type array, null given in Drupal\Core\Entity\Element\EntityAutocomplete::Drupal\Core\Entity\Element\{closure}() (line 80 of /app/web/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php).

Once the layout is saved, the page becomes inaccessible due to the following error:

#1 /app/web/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php(83): array_map(Object(Closure), Array)
#2 [internal function]: Drupal\Core\Entity\Element\EntityAutocomplete::valueCallback(Array, Array, Object(Drupal\Core\Form\FormState))
#3 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(1256): call_user_func_array(Array, Array)
#4 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(991): Drupal\Core\Form\FormBuilder->handleInputElement('views_exposed_f...', Array, Object(Drupal\Core\Form\FormState))
#5 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(1061): Drupal\Core\Form\FormBuilder->doBuildForm('views_exposed_f...', Array, Object(Drupal\Core\Form\FormState))
#6 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(562): Drupal\Core\Form\FormBuilder->doBuildForm('views_exposed_f...', Array, Object(Drupal\Core\Form\FormState))
#7 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(319): Drupal\Core\Form\FormBuilder->processForm('views_exposed_f...', Array, Object(Drupal\Core\Form\FormState))
#8 /app/web/core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginBase.php(154): Drupal\Core\Form\FormBuilder->buildForm('\\Drupal\\views\\F...', Object(Drupal\Core\Form\FormState))
#9 /app/web/core/modules/views/src/ViewExecutable.php(1238): Drupal\views\Plugin\views\exposed_form\ExposedFormPluginBase->renderExposedForm()
#10 /app/web/core/modules/views/src/ViewExecutable.php(1391): Drupal\views\ViewExecutable->build(NULL)
#11 /app/web/core/modules/views/src/ViewExecutable.php(1454): Drupal\views\ViewExecutable->execute(NULL)
#12 /app/web/core/modules/views/src/Plugin/views/display/Block.php(131): Drupal\views\ViewExecutable->render()
#13 /app/web/core/modules/views/src/ViewExecutable.php(1630): Drupal\views\Plugin\views\display\Block->execute()
#14 /app/web/core/modules/views/src/Element/View.php(77): Drupal\views\ViewExecutable->executeDisplay('bibliographic_r...', Array)
#15 /app/web/core/modules/views/src/Plugin/Block/ViewsBlock.php(59): Drupal\views\Element\View::preRenderViewElement(Array)
#16 /app/web/core/modules/layout_builder/src/EventSubscriber/BlockComponentRenderArray.php(116): Drupal\views\Plugin\Block\ViewsBlock->build()
#17 [internal function]: Drupal\layout_builder\EventSubscriber\BlockComponentRenderArray->onBuildRender(Object(Drupal\layout_builder\Event\SectionComponentBuildRenderArrayEvent), 'section_compone...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#18 /app/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Drupal\layout_builder\Event\SectionComponentBuildRenderArrayEvent), 'section_compone...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#19 /app/web/core/modules/layout_builder/src/SectionComponent.php(90): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('section_compone...', Object(Drupal\layout_builder\Event\SectionComponentBuildRenderArrayEvent))
#20 /app/web/core/modules/layout_builder/src/Section.php(86): Drupal\layout_builder\SectionComponent->toRenderArray(Array, true)
#21 /app/web/core/modules/layout_builder/src/Element/LayoutBuilder.php(247): Drupal\layout_builder\Section->toRenderArray(Array, true)
#22 /app/web/modules/contrib/layout_builder_st/src/Element/LayoutBuilder.php(80): Drupal\layout_builder\Element\LayoutBuilder->buildAdministrativeSection(Object(Drupal\layout_builder_st\Plugin\SectionStorage\OverridesSectionStorage), 0)
#23 /app/web/core/modules/layout_builder/src/Element/LayoutBuilder.php(123): Drupal\layout_builder_st\Element\LayoutBuilder->buildAdministrativeSection(Object(Drupal\layout_builder_st\Plugin\SectionStorage\OverridesSectionStorage), 0)
#24 /app/web/core/modules/layout_builder/src/Element/LayoutBuilder.php(97): Drupal\layout_builder\Element\LayoutBuilder->layout(Object(Drupal\layout_builder_st\Plugin\SectionStorage\OverridesSectionStorage))
#25 [internal function]: Drupal\layout_builder\Element\LayoutBuilder->preRender(Array)
#26 /app/web/core/lib/Drupal/Core/Render/Renderer.php(378): call_user_func(Array, Array)
#27 /app/web/core/lib/Drupal/Core/Render/Renderer.php(195): Drupal\Core\Render\Renderer->doRender(Array, true)
#28 /app/web/core/lib/Drupal/Core/Render/Renderer.php(139): Drupal\Core\Render\Renderer->render(Array, true)
#29 /app/web/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}()
#30 /app/web/core/lib/Drupal/Core/Render/Renderer.php(140): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#31 /app/web/core/lib/Drupal/Core/Ajax/CommandWithAttachedAssetsTrait.php(33): Drupal\Core\Render\Renderer->renderRoot(Array)
#32 /app/web/core/lib/Drupal/Core/Ajax/ReplaceCommand.php(31): Drupal\Core\Ajax\InsertCommand->getRenderedContent()
#33 /app/web/core/lib/Drupal/Core/Ajax/AjaxResponse.php(43): Drupal\Core\Ajax\ReplaceCommand->render()
#34 /app/web/core/modules/layout_builder/src/Controller/LayoutRebuildTrait.php(47): Drupal\Core\Ajax\AjaxResponse->addCommand(Object(Drupal\Core\Ajax\ReplaceCommand))
#35 /app/web/core/modules/layout_builder/src/Controller/LayoutRebuildTrait.php(26): Drupal\layout_builder\Form\ConfigureBlockFormBase->rebuildLayout(Object(Drupal\layout_builder_st\Plugin\SectionStorage\OverridesSectionStorage))
#36 /app/web/core/modules/layout_builder/src/Form/ConfigureBlockFormBase.php(242): Drupal\layout_builder\Form\ConfigureBlockFormBase->rebuildAndClose(Object(Drupal\layout_builder_st\Plugin\SectionStorage\OverridesSectionStorage))
#37 /app/web/core/lib/Drupal/Core/Ajax/AjaxFormHelperTrait.php(39): Drupal\layout_builder\Form\ConfigureBlockFormBase->successfulAjaxSubmit(Array, Object(Drupal\Core\Form\FormState))
#38 [internal function]: Drupal\layout_builder\Form\ConfigureBlockFormBase->ajaxSubmit(Array, Object(Drupal\Core\Form\FormState), Object(Symfony\Component\HttpFoundation\Request))
#39 /app/web/core/lib/Drupal/Core/Form/FormAjaxResponseBuilder.php(69): call_user_func_array(Array, Array)
#40 /app/web/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)
#41 [internal function]: Drupal\Core\Form\EventSubscriber\FormAjaxSubscriber->onException(Object(Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent), 'kernel.exceptio...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#42 /app/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent), 'kernel.exceptio...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#43 /app/vendor/symfony/http-kernel/HttpKernel.php(228): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.exceptio...', Object(Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent))
#44 /app/vendor/symfony/http-kernel/HttpKernel.php(79): Symfony\Component\HttpKernel\HttpKernel->handleException(Object(Drupal\Core\Form\FormAjaxException), Object(Symfony\Component\HttpFoundation\Request), 1)
#45 /app/web/modules/contrib/simple_oauth/src/HttpMiddleware/BasicAuthSwap.php(67): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#46 /app/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#47 /app/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#48 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#49 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#50 /app/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#51 /app/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#52 /app/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#53 /app/web/core/lib/Drupal/Core/DrupalKernel.php(693): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#54 /app/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#55 {main}.
πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
EntityΒ  β†’

Last updated about 13 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States clayfreeman Paragould, AR

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

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