114 private $mediaDirectory;
146 $this->validator = $context->getValidator();
147 $this->resolver = $context->getResolver();
148 $this->_filesystem = $context->getFilesystem();
149 $this->templateEnginePool = $context->getEnginePool();
150 $this->_storeManager = $context->getStoreManager();
151 $this->_appState = $context->getAppState();
152 $this->templateContext = $this;
153 $this->pageConfig = $context->getPageConfig();
154 parent::__construct($context,
$data);
174 parent::_construct();
182 if ($this->
hasData(
'template')) {
232 return $this->
_getData(
'area') ? $this->
_getData(
'area') : $this->_appState->getAreaCode();
244 if (is_array($key)) {
245 foreach ($key as $subKey => $subValue) {
246 $this->
assign($subKey, $subValue);
249 $this->_viewVars[$key] =
$value;
263 \Magento\Framework\Profiler::start(
265 [
'group' =>
'TEMPLATE',
'file_name' => $relativeFilePath]
268 if ($this->validator->isValid(
$fileName)) {
270 $templateEngine = $this->templateEnginePool->get(
$extension);
271 $html = $templateEngine->render($this->templateContext,
$fileName, $this->_viewVars);
275 $errorMessage =
"Invalid template file: '{$templatePath}' in module: '{$this->getModuleName()}'" 276 .
" block's name: '{$this->getNameInLayout()}'";
278 throw new \Magento\Framework\Exception\ValidatorException(
284 $this->_logger->critical($errorMessage);
287 \Magento\Framework\Profiler::stop(
'TEMPLATE:' .
$fileName);
311 if (!$this->_baseUrl) {
312 $this->_baseUrl = $this->_urlBuilder->getBaseUrl();
326 return $object->getDataUsingMethod((
string)$key);
338 $this->_storeManager->getStore()->getCode(),
352 if (
null === $this->directory) {
366 if (!$this->mediaDirectory) {
369 return $this->mediaDirectory;
getData($key='', $index=null)
assign($key, $value=null)
const XML_PATH_TEMPLATE_ALLOW_SYMLINK
getTemplateFile($template=null)
__construct(Template\Context $context, array $data=[])
getObjectData(\Magento\Framework\DataObject $object, $key)
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
setTemplateContext($templateContext)