diff --git a/core/modules/block/src/BlockViewBuilder.php b/core/modules/block/src/BlockViewBuilder.php index 9a582352..6fc5b2f 100644 --- a/core/modules/block/src/BlockViewBuilder.php +++ b/core/modules/block/src/BlockViewBuilder.php @@ -16,6 +16,7 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Language\LanguageManagerInterface; +use Drupal\Core\Plugin\ContextAwarePluginInterface; use Drupal\Core\Render\Element; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -104,7 +105,8 @@ public function viewMultiple(array $entities = array(), $view_mode = 'full', $la // Allow altering of cacheability metadata or setting #create_placeholder. $this->moduleHandler->alter(['block_build', "block_build_" . $plugin->getBaseId()], $build[$entity_id], $plugin); - if ($plugin instanceof MainContentBlockPluginInterface) { + if ($plugin instanceof MainContentBlockPluginInterface + || ($plugin instanceof ContextAwarePluginInterface && !empty($plugin->getContextMapping()))) { // Immediately build a #pre_render-able block, since this block cannot // be built lazily. $build[$entity_id] += static::buildPreRenderableBlock($entity, $this->moduleHandler());