![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-cms/Block/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Cms\Block; use Magento\Framework\View\Element\AbstractBlock; /** * Cms block content block * @deprecated This class introduces caching issues and should no longer be used * @see \Magento\Cms\Block\BlockByIdentifier */ class Block extends AbstractBlock implements \Magento\Framework\DataObject\IdentityInterface { /** * Prefix for cache key of CMS block */ const CACHE_KEY_PREFIX = 'CMS_BLOCK_'; /** * @var \Magento\Cms\Model\Template\FilterProvider */ protected $_filterProvider; /** * Store manager * * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * Block factory * * @var \Magento\Cms\Model\BlockFactory */ protected $_blockFactory; /** * Construct * * @param \Magento\Framework\View\Element\Context $context * @param \Magento\Cms\Model\Template\FilterProvider $filterProvider * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Cms\Model\BlockFactory $blockFactory * @param array $data */ public function __construct( \Magento\Framework\View\Element\Context $context, \Magento\Cms\Model\Template\FilterProvider $filterProvider, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Cms\Model\BlockFactory $blockFactory, array $data = [] ) { parent::__construct($context, $data); $this->_filterProvider = $filterProvider; $this->_storeManager = $storeManager; $this->_blockFactory = $blockFactory; } /** * 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; } /** * Return identifiers for produced content * * @return array */ public function getIdentities() { return [\Magento\Cms\Model\Block::CACHE_TAG . '_' . $this->getBlockId()]; } /** * @inheritdoc */ public function getCacheKeyInfo() { $cacheKeyInfo = parent::getCacheKeyInfo(); $cacheKeyInfo[] = $this->_storeManager->getStore()->getId(); return $cacheKeyInfo; } }