Skip to content

Commit 46e4947

Browse files
committed
Create TemplateProcessorBlock.php
1 parent 8f58b85 commit 46e4947

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

TemplateProcessorBlock.php

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
require dirname(__FILE__) . '/app/bootstrap.php';
4+
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
5+
6+
class Outslide extends \Magento\Framework\App\Http
7+
implements \Magento\Framework\AppInterface {
8+
public function launch()
9+
{
10+
11+
$this->_state->setAreaCode('frontend');
12+
// $this->_state->setAreaCode('adminhtml');
13+
// $this->_state->setAreaCode(\Magento\Framework\App\Area::AREA_FRONTEND);
14+
// $this->_state->setAreaCode(\Magento\Framework\App\Area::AREA_ADMINHTML);
15+
16+
$block = $this->_objectManager->create('\Magento\Cms\Model\Block');
17+
$filterProvider = $this->_objectManager->create('Magento\Cms\Model\Template\FilterProvider');
18+
$storeManager = $this->_objectManager->create('Magento\Store\Model\StoreManagerInterface');
19+
20+
$blockId = 1; // Id of block you want get content
21+
$storeId = $storeManager->getStore()->getId();
22+
$block->setStoreId($storeId)->load($blockId);
23+
$content = $block->getContent();
24+
$html = $filterProvider->getBlockFilter()->setStoreId($storeId)->filter($content);
25+
echo $html;
26+
//the method must end with this line
27+
return $this->_response;
28+
}
29+
}
30+
31+
/** @var \Magento\Framework\App\Http $app */
32+
$app = $bootstrap->createApplication('Outslide');
33+
$bootstrap->run($app);

0 commit comments

Comments
 (0)