Problem/Motivation

With drupal 10.3 and the Patch/MR from #2916876: Add visibility control conditions to blocks within Layout Builder I am able to add visibilty conditions in layout_builder. This works fine for non-navigation layout builder. From this I assume, it also should work with navigation blocks.

Patches/MR tested:

When I add a condition to a navigation block, I get a WSOD on any page with the navigation:

Drupal\Component\Plugin\Exception\ContextException: Assigned contexts were not satisfied: user in Drupal\Core\Plugin\Context\ContextHandler->applyContextMapping() (line 145 of /home/andi/git/site-h4d-greenopolis/web/core/lib/Drupal/Core/Plugin/Context/ContextHandler.php).

Steps to reproduce

  1. Add patch
  2. Add visibility condition e.g. on user menu block in /admin/config/user-interface/navigation-block
  3. See WSOD on pages with navigation

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

anruether created an issue. See original summary.

anruether’s picture

Backtrace:

#0 /home/andi/git/site-h4d-greenopolis/web/core/modules/layout_builder/src/EventSubscriber/SectionComponentVisibility.php(53): Drupal\Core\Plugin\Context\ContextHandler->applyContextMapping()
#1 [internal function]: Drupal\layout_builder\EventSubscriber\SectionComponentVisibility->onBuildRender()
#2 /home/andi/git/site-h4d-greenopolis/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func()
#3 /home/andi/git/site-h4d-greenopolis/web/core/modules/layout_builder/src/SectionComponent.php(90): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#4 /home/andi/git/site-h4d-greenopolis/web/core/modules/layout_builder/src/Section.php(88): Drupal\layout_builder\SectionComponent->toRenderArray()
#5 /home/andi/git/site-h4d-greenopolis/web/core/modules/navigation/src/NavigationRenderer.php(114): Drupal\layout_builder\Section->toRenderArray()
#6 /home/andi/git/site-h4d-greenopolis/web/core/modules/navigation/navigation.module(54): Drupal\navigation\NavigationRenderer->buildNavigation()
#7 /home/andi/git/site-h4d-greenopolis/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(352): navigation_page_top()
#8 /home/andi/git/site-h4d-greenopolis/web/modules/contrib/hux/src/HuxModuleHandler.php(100): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
#9 /home/andi/git/site-h4d-greenopolis/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(396): Drupal\hux\HuxModuleHandler->Drupal\hux\{closure}()
#10 /home/andi/git/site-h4d-greenopolis/web/modules/contrib/hux/src/HuxModuleHandler.php(103): Drupal\Core\Extension\ModuleHandler->invokeAllWith()
#11 /home/andi/git/site-h4d-greenopolis/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(349): Drupal\hux\HuxModuleHandler->invokeAllWith()
#12 /home/andi/git/site-h4d-greenopolis/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(146): Drupal\Core\Render\MainContent\HtmlRenderer->buildPageTopAndBottom()
#13 /home/andi/git/site-h4d-greenopolis/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse()
#14 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
#15 /home/andi/git/site-h4d-greenopolis/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func()
#16 /home/andi/git/site-h4d-greenopolis/vendor/symfony/http-kernel/HttpKernel.php(186): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#17 /home/andi/git/site-h4d-greenopolis/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#18 /home/andi/git/site-h4d-greenopolis/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#19 /home/andi/git/site-h4d-greenopolis/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#20 /home/andi/git/site-h4d-greenopolis/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#21 /home/andi/git/site-h4d-greenopolis/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\ContentLength->handle()
#22 /home/andi/git/site-h4d-greenopolis/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#23 /home/andi/git/site-h4d-greenopolis/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#24 /home/andi/git/site-h4d-greenopolis/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#25 /home/andi/git/site-h4d-greenopolis/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#26 /home/andi/git/site-h4d-greenopolis/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#27 /home/andi/git/site-h4d-greenopolis/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#28 /home/andi/git/site-h4d-greenopolis/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#29 /home/andi/git/site-h4d-greenopolis/vendor/drush/drush/misc/d8-rs-router.php(48): require('...')
#30 {main}
anruether’s picture

Issue summary: View changes
larowlan’s picture

Status: Active » Closed (duplicate)

Please report that in the issue for the patch you're using

Thanks

anruether’s picture