diff --git a/core/modules/block_content/src/Plugin/Block/BlockContentBlock.php b/core/modules/block_content/src/Plugin/Block/BlockContentBlock.php index 8d55658..42dbd53 100644 --- a/core/modules/block_content/src/Plugin/Block/BlockContentBlock.php +++ b/core/modules/block_content/src/Plugin/Block/BlockContentBlock.php @@ -147,7 +147,8 @@ public function blockSubmit($form, FormStateInterface $form_state) { * {@inheritdoc} */ protected function blockAccess(AccountInterface $account) { - if ($this->getEntity()) { + $block = $this->getEntity(); + if ($block->isPublished()) { return $this->getEntity()->access('view', $account, TRUE); } return AccessResult::forbidden(); @@ -158,11 +159,7 @@ protected function blockAccess(AccountInterface $account) { */ public function build() { if ($block = $this->getEntity()) { - if ($block->isPublished()) { - return $this->entityManager - ->getViewBuilder($block->getEntityTypeId()) - ->view($block, $this->configuration['view_mode']); - } + return $this->entityManager->getViewBuilder($block->getEntityTypeId())->view($block, $this->configuration['view_mode']); } else { return array(