Example #1
0
 /**
  * Prepare Content HTML
  *
  * @return string
  */
 protected function _toHtml()
 {
     $blockId = $this->getBlockId();
     $html = '';
     if ($blockId) {
         $storeId = $this->_storeManager->getStore()->getId();
         /** @var \Magento\Cms\Model\Block $block */
         $block = $this->_blockFactory->create();
         $block->setStoreId($storeId)->load($blockId);
         if ($block->isActive()) {
             $html = $this->_filterProvider->getBlockFilter()->setStoreId($storeId)->filter($block->getContent());
         }
     }
     return $html;
 }
Example #2
0
 /**
  * Prepare block text and determine whether block output enabled or not
  * Prevent blocks recursion if needed
  *
  * @return $this
  */
 protected function _beforeToHtml()
 {
     parent::_beforeToHtml();
     $blockId = $this->getData('block_id');
     $blockHash = get_class($this) . $blockId;
     if (isset(self::$_widgetUsageMap[$blockHash])) {
         return $this;
     }
     self::$_widgetUsageMap[$blockHash] = true;
     if ($blockId) {
         $storeId = $this->_storeManager->getStore()->getId();
         /** @var \Magento\Cms\Model\Block $block */
         $block = $this->_blockFactory->create();
         $block->setStoreId($storeId)->load($blockId);
         if ($block->isActive()) {
             $this->setText($this->_filterProvider->getBlockFilter()->setStoreId($storeId)->filter($block->getContent()));
         }
     }
     unset(self::$_widgetUsageMap[$blockHash]);
     return $this;
 }
Example #3
0
 protected function _toHtml()
 {
     $storeId = $this->_storeManager->getStore()->getId();
     $html = $this->filterProvider->getBlockFilter()->setStoreId($storeId)->filter($this->getWidgetContent());
     return $html;
 }
 /**
  * @covers \Magento\Cms\Model\Template\FilterProvider::getBlockFilter
  */
 public function testGetBlockFilter()
 {
     $this->assertInstanceOf('Magento\\Cms\\Model\\Template\\Filter', $this->_model->getBlockFilter());
 }