Adding Nested paragraphs with Frontend editing Throws error!

Created on 24 April 2024, 2 months ago
Updated 2 May 2024, about 2 months ago

TypeError: array_search(): Argument #2 ($haystack) must be of type array, string given in array_search() (line 200 of core/lib/Drupal/Core/Config/Entity/Query/Condition.php).

I have Two Column Section inside of One Column section using paragraphs module and when i add another paragraph inside one Column Section below Two Column, it throws the below error. I have Drupal 10.2 installed

Drupal\Core\Config\Entity\Query\Condition->match(Array, 'accordion') (Line: 145)
Drupal\Core\Config\Entity\Query\Condition->matchArray(Array, Array, Array) (Line: 50)
Drupal\Core\Config\Entity\Query\Condition->compile(Array) (Line: 85)
Drupal\Core\Config\Entity\Query\Query->execute() (Line: 560)
Drupal\frontend_editing\Controller\FrontendEditingController->paragraphAddPage('paragraph', '239', 'field_left', '238', '0', Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 627)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->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: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

πŸ› Bug report
Status

Needs review

Version

1.7

Component

Code

Created by

πŸ‡΅πŸ‡°Pakistan Ahmad Aziz

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

Merge Requests

Comments & Activities

  • Issue created by @Ahmad Aziz
  • πŸ‡©πŸ‡ͺGermany a.dmitriiev

    Ahmad Aziz, could you please make a screenshot of the whole page for field settings of this field_left, where you are trying to add the paragraph.

    Normally on that line 560 in Drupal\frontend_editing\Controller\FrontendEditingController the variable $allowed_paragraphs should be always an array. But I have never tested with "Reference method" that is not "Default". It seems that you have some other method selected, or some more paragraph related modules enabled. Your settings page would be interesting to see and it might help to include your use case to avoid the problems in the future.

    For now I will just add the check for type, to ensure that condition in query works properly, but it would be nice to see your settings.

    Thank you.

  • Status changed to Needs review 2 months ago
  • πŸ‡΅πŸ‡°Pakistan Ahmad Aziz

    Here is the screenshot for field_left settings, Basically the nested paragraph(heading here) can be added when i edit the parent section paragraph but when i click on the plus button below the heading paragraph inside section paragraph, then it Throws the above error!

  • πŸ‡©πŸ‡ͺGermany a.dmitriiev

    Thank you for the screenshot. It is still weird to me that the value for accordion is still passed instead of the empty array. Have you tried the fix from the MR? Does it help?

Production build 0.69.0 2024