Hi,
I'm using this module to insert a views bloc display into a node. All go right for a first node, but ion another one, I'm unable to validate my choice because of "An illegal choice.." ( Un choix interdit a été détecté. Veuillez contacter l'administrateur du site) .
Content come from a migration process but it's the first time I meet this issue.
Perhaps Views related issue ? Watchdog extract:
/node/39/edit?destination=/fr/admin/content%3Ftitle%3D%26type%3DAll%26status%3DAll%26langcode%3DAll%26term_node_tid_depth%3D87%26term_node_tid_depth_1%3DAll
Warning : Illegal string offset 'value' dans Drupal\views\Plugin\views\area\Text->preQuery() (/sited8/core/modules/views/src/Plugin/views/area/Text.php ligne 50) #0 /sited8/core/includes/bootstrap.inc(584): _drupal_error_handler_real(2, 'Illegal string ...', '/home/provence-...', 50, Array) #1 /sited8/core/modules/views/src/Plugin/views/area/Text.php(50): _drupal_error_handler(2, 'Illegal string ...', '/home/provence-...', 50, Array) #2 /sited8/core/modules/views/src/ViewExecutable.php(1011): Drupal\views\Plugin\views\area\Text->preQuery() #3 /sited8/core/modules/views/src/ViewExecutable.php(1233): Drupal\views\ViewExecutable->_preQuery() #4 /sited8/core/modules/views/src/Plugin/views/display/PathPluginBase.php(390): Drupal\views\ViewExecutable->build() #5 /sited8/core/modules/views/src/Plugin/views/display/Page.php(180): Drupal\views\Plugin\views\display\PathPluginBase->execute() #6 /sited8/core/modules/views/src/ViewExecutable.php(1630): Drupal\views\Plugin\views\display\Page->execute() #7 /sited8/core/modules/views/src/Element/View.php(77): Drupal\views\ViewExecutable->executeDisplay('page', Array) #8 [internal function]: Drupal\views\Element\View::preRenderViewElement(Array) #9 /sited8/core/lib/Drupal/Core/Render/Renderer.php(378): call_user_func(Array, Array) #10 /sited8/core/lib/Drupal/Core/Render/Renderer.php(195): Drupal\Core\Render\Renderer->doRender(Array, false) #11 /sited8/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(226): Drupal\Core\Render\Renderer->render(Array, false) #12 /sited8/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() #13 /sited8/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(227): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #14 /sited8/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(117): Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch)) #15 /sited8/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch)) #16 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object(Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) #17 /sited8/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) #18 /sited8/vendor/symfony/http-kernel/HttpKernel.php(156): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object(Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent)) #19 /sited8/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #20 /sited8/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #21 /sited8/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #22 /sited8/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #23 /sited8/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #24 /sited8/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #25 /sited8/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #26 /sited8/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #27 /sited8/core/lib/Drupal/Core/DrupalKernel.php(693): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #28 /sited8/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #29 {main}.
The views preview is working for this display.
Thanks for help.
Comments
Comment #2
aiphesComment #3
aiphesAnother issue, different warning message:
Warning : count(): Parameter must be an array or an object that implements Countable dans Drupal\viewsreference\Plugin\Field\FieldWidget\ViewsReferenceSelectWidget->formElement() (/home/www/sited8/modules/contrib/viewsreference/src/Plugin/Field/FieldWidget/ViewsReferenceSelectWidget.php ligne 38)Drupal 8.6.15 / PHP 7.2
Comment #4
aiphesFound a work around with changing the field value with VBO and views_bulk_edit module. Then I seem to be able to edit nodes as usual.
Comment #5
aiphesStill there on D8.7.1
Comment #6
bryandenijsI have the same issue and can confirm this bug.
Steps to reproduce:
- Create a viewsreference field on a content type.
- Do not make it required
- Create a new node of this content type without filling in the viewsreference field (keep it untouched).
- Edit the node
- Choose a view in de viewsreference field
- The Display ID is automatically filled.
- Submit the node.
- Boom: error on Display ID: "An illegal choice has been detected. Please contact the site administrator."
Comment #7
bryandenijsI created a small patch as a workaround.
It is not perfect, but for now it solves the problem.
Comment #8
bryandenijsComment #9
aiphesTemporary workaround is to use https://www.drupal.org/project/viewfield instead. At this point, I didn't met the issue describe for viewsreference.
Comment #10
andres.torres commentedSame error here, applied the patch but no luck.
Comment #11
prethiee commentedI'm also facing the same issue, in my case when I was trying to add multiple paragraphs entities the ajax function in the module gets called and validates from the viewreference module, and throws illegal error because on page load the view filter option is set to
none, but the display id filter shows all the input. So, changed the default list of filter items that can be shown, attaching a patch that worked in my case.Comment #12
prethiee commentedComment #13
prethiee commentedFor version 8.x-1.6
Comment #14
carlitus commented#13 doesn't works for me. I use the reference field in a paragraph with paragraphs layouts.