diff --git a/core/modules/block_content/src/Plugin/views/area/ListingEmpty.php b/core/modules/block_content/src/Plugin/views/area/ListingEmpty.php index 681f664..3bc4e95 100644 --- a/core/modules/block_content/src/Plugin/views/area/ListingEmpty.php +++ b/core/modules/block_content/src/Plugin/views/area/ListingEmpty.php @@ -73,6 +73,7 @@ public static function create(ContainerInterface $container, array $configuratio */ public function render($empty = FALSE) { if (!$empty || !empty($this->options['empty'])) { + $access_result = $this->accessManager->checkNamedRoute('block_content.add_page', array(), $this->currentUser, TRUE); $element = array( '#theme' => 'links', '#links' => array( @@ -81,7 +82,12 @@ public function render($empty = FALSE) { 'title' => $this->t('Add a custom block'), ), ), - '#access' => $this->accessManager->checkNamedRoute('block_content.add_page', array(), $this->currentUser), + '#access' => $access_result->isAllowed(), + '#cache' => [ + 'contexts' => $access_result->getCacheContexts(), + 'tags' => $access_result->getCacheTags(), + 'max-age' => $access_result->getCacheMaxAge(), + ], ); return $element; }