I'm trying to add "Any data" contexts to a Page Variant with: entity:node:field_name data and facing this error:

Warning: Missing argument 1 for Drupal\page_manager_ui\Form\PageVariantContextsForm::getContextClass(), called in /home/vagrant/builtinx/docroot/modules/contrib/page_manager/page_manager_ui/src/Form/PageVariantContextsForm.php on line 35 and defined in Drupal\page_manager_ui\Form\PageVariantContextsForm->getContextClass() (line 54 of /home/vagrant/builtinx/docroot/modules/contrib/page_manager/page_manager_ui/src/Form/PageVariantContextsForm.php) #0 /home/vagrant/builtinx/docroot/core/includes/bootstrap.inc(546): _drupal_error_handler_real(2, 'Missing argumen...', '/home/vagrant/b...', 54, Array) #1 /home/vagrant/builtinx/docroot/modules/contrib/page_manager/page_manager_ui/src/Form/PageVariantContextsForm.php(54): _drupal_error_handler(2, 'Missing argumen...', '/home/vagrant/b...', 54, Array) #2 /home/vagrant/builtinx/docroot/modules/contrib/page_manager/page_manager_ui/src/Form/PageVariantContextsForm.php(35): Drupal\page_manager_ui\Form\PageVariantContextsForm->getContextClass() #3 [internal function]: Drupal\page_manager_ui\Form\PageVariantContextsForm->addContext(Array, Object(Drupal\Core\Form\FormState), Object(Symfony\Component\HttpFoundation\Request)) #4 /home/vagrant/builtinx/docroot/core/lib/Drupal/Core/Form/FormAjaxResponseBuilder.php(69): call_user_func_array(Array, Array) #5 /home/vagrant/builtinx/docroot/core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php(98): Drupal\Core\Form\FormAjaxResponseBuilder->buildResponse(Object(Symfony\Component\HttpFoundation\Request), Array, Object(Drupal\Core\Form\FormState), Array) #6 /home/vagrant/builtinx/docroot/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): Drupal\Core\Form\EventSubscriber\FormAjaxSubscriber->onException(Object(Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent), 'kernel.exceptio...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) #7 /home/vagrant/builtinx/vendor/symfony/http-kernel/HttpKernel.php(221): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.exceptio...', Object(Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent)) #8 /home/vagrant/builtinx/vendor/symfony/http-kernel/HttpKernel.php(75): Symfony\Component\HttpKernel\HttpKernel->handleException(Object(Drupal\Core\Form\FormAjaxException), Object(Symfony\Component\HttpFoundation\Request), 1) #9 /home/vagrant/builtinx/docroot/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #10 /home/vagrant/builtinx/docroot/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #11 /home/vagrant/builtinx/docroot/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #12 /home/vagrant/builtinx/docroot/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #13 /home/vagrant/builtinx/docroot/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #14 /home/vagrant/builtinx/docroot/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(50): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #15 /home/vagrant/builtinx/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #16 /home/vagrant/builtinx/docroot/core/lib/Drupal/Core/DrupalKernel.php(649): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #17 /home/vagrant/builtinx/docroot/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #18 {main}.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cr0ss created an issue. See original summary.

Antonnavi’s picture

Status: Active » Needs review
FileSize
1.22 KB

Got the same issue.
But in my case error text was a bit different:

ArgumentCountError: Too few arguments to function Drupal\page_manager_ui\Form\PageVariantContextsForm::getContextClass(), 0 passed in /var/www/html/modules/page_manager/page_manager_ui/src/Form/PageVariantContextsForm.php on line 35 and exactly 1 expected in Drupal\page_manager_ui\Form\PageVariantContextsForm->getContextClass() (line 54 of /var/www/html/modules/page_manager/page_manager_ui/src/Form/PageVariantContextsForm.php) #0 /var/www/html/modules/page_manager/page_manager_ui/src/Form/PageVariantContextsForm.php(35): Drupal\page_manager_ui\Form\PageVariantContextsForm->getContextClass()

Attached patch fix this issue.

karolus’s picture

Just tried apply patch in #2, this is what I got:

Notice: Undefined variable: value in Drupal\ctools\Form\ContextConfigure->submitForm() (line 177 of /Users/karolus/Sites/kkonlined8/modules/ctools/src/Form/ContextConfigure.php) #0 /Users/karolus/Sites/kkonlined8/core/includes/bootstrap.inc(552): _drupal_error_handler_real(8, 'Undefined varia...', '/Users/karolus/...', 177, Array) #1 /Users/karolus/Sites/kkonlined8/modules/ctools/src/Form/ContextConfigure.php(177): _drupal_error_handler(8, 'Undefined varia...', '/Users/karolus/...', 177, Array) #2 [internal function]: Drupal\ctools\Form\ContextConfigure->submitForm(Array, Object(Drupal\Core\Form\FormState)) #3 /Users/karolus/Sites/kkonlined8/core/lib/Drupal/Core/Form/FormSubmitter.php(111): call_user_func_array(Array, Array) #4 /Users/karolus/Sites/kkonlined8/core/lib/Drupal/Core/Form/FormSubmitter.php(51): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState)) #5 /Users/karolus/Sites/kkonlined8/core/lib/Drupal/Core/Form/FormBuilder.php(585): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState)) #6 /Users/karolus/Sites/kkonlined8/core/lib/Drupal/Core/Form/FormBuilder.php(314): Drupal\Core\Form\FormBuilder->processForm('ctools_context_...', Array, Object(Drupal\Core\Form\FormState)) #7 /Users/karolus/Sites/kkonlined8/core/lib/Drupal/Core/Controller/FormController.php(74): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\page_manager_ui\Form\StaticContextConfigure), Object(Drupal\Core\Form\FormState)) #8 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch)) #9 /Users/karolus/Sites/kkonlined8/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #10 /Users/karolus/Sites/kkonlined8/core/lib/Drupal/Core/Render/Renderer.php(574): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #11 /Users/karolus/Sites/kkonlined8/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #12 /Users/karolus/Sites/kkonlined8/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #13 [internal function]: Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #14 /Users/karolus/Sites/kkonlined8/vendor/symfony/http-kernel/HttpKernel.php(144): call_user_func_array(Object(Closure), Array) #15 /Users/karolus/Sites/kkonlined8/vendor/symfony/http-kernel/HttpKernel.php(64): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #16 /Users/karolus/Sites/kkonlined8/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #17 /Users/karolus/Sites/kkonlined8/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #18 /Users/karolus/Sites/kkonlined8/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #19 /Users/karolus/Sites/kkonlined8/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #20 /Users/karolus/Sites/kkonlined8/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #21 /Users/karolus/Sites/kkonlined8/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(50): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #22 /Users/karolus/Sites/kkonlined8/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #23 /Users/karolus/Sites/kkonlined8/core/lib/Drupal/Core/DrupalKernel.php(656): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #24 /Users/karolus/Sites/kkonlined8/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #25 {main}.

dcam’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -panels, -D8panels, -contexts

#2 is RTBC from me. I ran into this problem and fixed it the same way, which isn't saying much because it's an easy issue to solve.

The problem mentioned in #3 is an unrelated issue with CTools that happens to be exposed when using config entities as a context once this problem is solved. See #2696819: Cannot add contexts whose entity ids are not numeric.

dcam’s picture

alexmoreno’s picture

same, #2 fixed the issue for me. This is a critical issue that should be merged asap, IMHO.

alphawebgroup’s picture

Hi guys!
any chance to get this one committed? please...

tim.plunkett’s picture

Version: 8.x-1.x-dev » 8.x-4.x-dev
Issue tags: +Needs tests

This should include test coverage.

jonathanshaw’s picture

Status: Reviewed & tested by the community » Needs work

NW for tests. Should be easy to make a new tests based off StaticContextTest.

NickDJM’s picture

Updated patch to apply properly to 8.x-4.x

andypost’s picture

Both places should be fixed

I used to replicate StaticContextTest in UI and there's no ability to add any context but this test passed somehow

andypost’s picture

Status: Needs work » Needs review
manuel.adan’s picture

Status: Needs review » Reviewed & tested by the community

#11 works for me

daggerhart’s picture

Simple fix to a big problem. RTBC +1

Denes.Szabo’s picture

#11 tested and it works.

markdc’s picture

#11 works for me (D8.6.2)

pebosi’s picture

#11 works for me (D8.6.4)

iyyappan.govind’s picture

#11 works for me (D8.6.9)

  • manuel.adan committed 4d9bd6c on 8.x-4.x authored by andypost
    Issue #2799885 by andypost, Antonnavi: Warning: Missing argument 1 for...
manuel.adan’s picture

Priority: Major » Normal
Status: Reviewed & tested by the community » Fixed
Issue tags: -Needs tests

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Leonardo Le’s picture

#11 works for me (D8.7.8)