Skip to content

Commit 476a551

Browse files
committed
Add verification if Block is Enabled
1 parent 6e2f90b commit 476a551

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

app/code/Magento/Cms/Block/BlockByIdentifier.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ private function filterOutput(string $content): string
107107
*
108108
* @return BlockInterface|BlockModel
109109
* @throws \InvalidArgumentException
110+
* @throws NoSuchEntityException
110111
*/
111112
private function getCmsBlock(): BlockInterface
112113
{
@@ -119,6 +120,12 @@ private function getCmsBlock(): BlockInterface
119120
(string)$this->getIdentifier(),
120121
$this->getCurrentStoreId()
121122
);
123+
124+
if (!$this->cmsBlock->isActive()) {
125+
throw new NoSuchEntityException(
126+
__('The CMS block with identifier "%identifier" is not enabled.', $this->getIdentifier())
127+
);
128+
}
122129
}
123130

124131
return $this->cmsBlock;

0 commit comments

Comments
 (0)