blockRepository = $blockRepository; $this->widgetFilter = $widgetFilter; } /** * Get block data * * @param string $blockIdentifier * @return array * @throws NoSuchEntityException */ public function getData(string $blockIdentifier): array { $block = $this->blockRepository->getById($blockIdentifier); if (false === $block->isActive()) { throw new NoSuchEntityException( __('The CMS block with the "%1" ID doesn\'t exist.', $blockIdentifier) ); } $renderedContent = $this->widgetFilter->filter($block->getContent()); $blockData = [ BlockInterface::IDENTIFIER => $block->getIdentifier(), BlockInterface::TITLE => $block->getTitle(), BlockInterface::CONTENT => $renderedContent, ]; return $blockData; } }