Problem/Motivation
I get following error when trying to select an image from the media library on a content type.
Drupal\Component\Plugin\Exception\MissingValueContextException: Required contexts without a value: node in /var/www/html/core/lib/Drupal/Core/Plugin/Context/ContextHandler.php:150 Stack trace: #0 /var/www/html/modules/contrib/block_visibility_groups/src/GroupEvaluator.php(98): Drupal\Core\Plugin\Context\ContextHandler->applyContextMapping() #1 /var/www/html/modules/contrib/block_visibility_groups/src/GroupEvaluator.php(64): Drupal\block_visibility_groups\GroupEvaluator->applyContexts() #2 /var/www/html/modules/contrib/block_visibility_groups/src/Plugin/Condition/ConditionGroup.php(68): Drupal\block_visibility_groups\GroupEvaluator->evaluateGroup() #3 /var/www/html/core/lib/Drupal/Core/Condition/ConditionManager.php(76): Drupal\block_visibility_groups\Plugin\Condition\ConditionGroup->evaluate() #4 /var/www/html/core/lib/Drupal/Core/Condition/ConditionPluginBase.php(85): Drupal\Core\Condition\ConditionManager->execute() #5 /var/www/html/core/lib/Drupal/Core/Condition/ConditionAccessResolverTrait.php(26): Drupal\Core\Condition\ConditionPluginBase->execute() #6 /var/www/html/core/modules/block/src/BlockAccessControlHandler.php(116): Drupal\block\BlockAccessControlHandler->resolveConditions() #7 /var/www/html/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php(109): Drupal\block\BlockAccessControlHandler->checkAccess() #8 /var/www/html/core/lib/Drupal/Core/Entity/EntityBase.php(329): Drupal\Core\Entity\EntityAccessControlHandler->access() #9 /var/www/html/core/modules/block/src/BlockRepository.php(63): Drupal\Core\Entity\EntityBase->access() #10 /var/www/html/core/modules/block/src/Plugin/DisplayVariant/BlockPageVariant.php(138): Drupal\block\BlockRepository->getVisibleBlocksPerRegion() #11 /var/www/html/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(270): Drupal\block\Plugin\DisplayVariant\BlockPageVariant->build() #12 /var/www/html/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(128): Drupal\Core\Render\MainContent\HtmlRenderer->prepare() #13 /var/www/html/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() #14 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray() #15 /var/www/html/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func() #16 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(186): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() #17 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw() #18 /var/www/html/modules/contrib/simple_oauth/src/HttpMiddleware/BasicAuthSwap.php(68): Symfony\Component\HttpKernel\HttpKernel->handle() #19 /var/www/html/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle() #20 /var/www/html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle() #21 /var/www/html/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle() #22 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\ContentLength->handle() #23 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass() #24 /var/www/html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle() #25 /var/www/html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() #26 /var/www/html/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() #27 /var/www/html/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle() #28 /var/www/html/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionHtmlSubscriber.php(166): Drupal\Core\StackMiddleware\StackedHttpKernel->handle() #29 /var/www/html/core/lib/Drupal/Core/EventSubscriber/CustomPageExceptionHtmlSubscriber.php(119): Drupal\Core\EventSubscriber\DefaultExceptionHtmlSubscriber->makeSubrequest() #30 /var/www/html/core/lib/Drupal/Core/EventSubscriber/CustomPageExceptionHtmlSubscriber.php(71): Drupal\Core\EventSubscriber\CustomPageExceptionHtmlSubscriber->makeSubrequestToCustomPath() #31 /var/www/html/core/lib/Drupal/Core/EventSubscriber/HttpExceptionSubscriberBase.php(109): Drupal\Core\EventSubscriber\CustomPageExceptionHtmlSubscriber->on403() #32 [internal function]: Drupal\Core\EventSubscriber\HttpExceptionSubscriberBase->onException() #33 /var/www/html/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func() #34 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(239): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() #35 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(91): Symfony\Component\HttpKernel\HttpKernel->handleThrowable() #36 /var/www/html/modules/contrib/simple_oauth/src/HttpMiddleware/BasicAuthSwap.php(68): Symfony\Component\HttpKernel\HttpKernel->handle() #37 /var/www/html/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle() #38 /var/www/html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle() #39 /var/www/html/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle() #40 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\ContentLength->handle() #41 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass() #42 /var/www/html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle() #43 /var/www/html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() #44 /var/www/html/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() #45 /var/www/html/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle() #46 /var/www/html/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle() #47 /var/www/html/index.php(19): Drupal\Core\DrupalKernel->handle() #48 @main
Steps to reproduce
Not entirely sure how to reproduce this on a vanilla install.
Proposed resolution
See MR.
Remaining tasks
MR
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | 3487237-11.patch | 2.04 KB | aurora.luzzardi |
| #11 | 3487237-inter.diff | 2.18 KB | aurora.luzzardi |
| #6 | Captura de Tela 2024-11-27 às 12.23.25.png | 84.17 KB | aurora.luzzardi |
Issue fork block_visibility_groups-3487237
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
bramdriesenAdding a related issue, but not sure if that is the real underlaying problem.
Comment #4
bramdriesenComment #5
damienmckennaThank you for providing that, I ran into it on a site that was using 2.0.x but when it went away when I upgraded to 2.1.x I thought I had just borked up a patch locally.
We'll get this out in a new release so the 2.0.x branch can be stable again.
Comment #6
aurora.luzzardiHi, I'm moving this to needs work, after applying the diff with a patch (attached here), the blocks with multiple conditions did not show were they should.
I attached the image of my block_visibility_group configuration.
Comment #7
aurora.luzzardiComment #8
bramdriesenWhat's the issue then? :-)
Comment #9
aurora.luzzardiSorry, I mistyped! They did not show as they should.
When should match the Request Path, is always false and not showing on the page.
Seems that is not properly handling the context for the Request Path condition
Comment #10
aurora.luzzardiBy testing here, seems that the early is causing the issue, it's not allowing to go to the second condition to allow match the RequestPath conditon
I changed here for testing:
I will prepare the interdiff and a new patch in a few minutes to send here.
Comment #11
aurora.luzzardiHere the interdiff patch and a fullpatch for the current 2.0 version.
Comment #12
aurora.luzzardiComment #13
joevagyok commentedThe patch in #11 looks good. We are using it on our project.
Comment #14
scottsawyerI am using this on multiple sites, seems to do the trick. Thanks
Comment #15
jason.ullstam commentedI have also tested the patch from #11 and it is working for us. Any idea when this might get added to a release. I have hundreds of sites using this module and would prefer to not patch if possible.
Comment #17
damienmckennaThank you all for working through this bug and building a fix.
Committed.