Skip to content

Commit

Permalink
Prevent inactive blocks to be rendered
Browse files Browse the repository at this point in the history
  • Loading branch information
diazwatson committed Feb 13, 2018
1 parent f21e97d commit 7ac135d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Block/Html/TopMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,11 @@ public function getCategoryUrl($category)
*/
public function getCmsMenu($category)
{
$block = null;
$blockId = $category->getData('cms_block_menu');

return $blockId ? $this->blockRepository->getById($blockId)->getContent() : null;
if ($blockId) {
$block = $this->blockRepository->getById($blockId);
}
return ($block && $block->getData('is_active')) ? $block->getContent() : null;
}
}

0 comments on commit 7ac135d

Please sign in to comment.