Commit 7064385a authored by silverham's avatar silverham Committed by paulocs

Issue #3177008 by silverham, paulocs, DeaOm: Context mapping should happen...

Issue #3177008 by silverham, paulocs, DeaOm: Context mapping should happen before $block->access() - avoid WSOD for EntityField->blockAccess()
parent 0924f097
......@@ -205,6 +205,13 @@ class Blocks extends ContextReactionPluginBase implements ContainerFactoryPlugin
$block->setMainContent($main_content);
}
// Inject runtime contexts.
// Must be before $block->access() to prevent ContextException.
if ($block instanceof ContextAwarePluginInterface) {
$contexts = $this->contextRepository->getRuntimeContexts($block->getContextMapping());
$this->contextHandler->applyContextMapping($block, $contexts);
}
// Make sure the user is allowed to view the block.
$access = $block->access($this->account, TRUE);
$cacheability->addCacheableDependency($access);
......@@ -221,12 +228,6 @@ class Blocks extends ContextReactionPluginBase implements ContainerFactoryPlugin
$block->setTitle($title);
}
// Inject runtime contexts.
if ($block instanceof ContextAwarePluginInterface) {
$contexts = $this->contextRepository->getRuntimeContexts($block->getContextMapping());
$this->contextHandler->applyContextMapping($block, $contexts);
}
$context_entity = $this->entityTypeManager
->getStorage('context')
->load($configuration['context_id']);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment