Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Xhtml.php
Go to the documentation of this file.
1 <?php
7 
16 
21 {
25  protected $templateProvider;
26 
30  protected $resultFactory;
31 
35  protected $templateFactory;
36 
40  protected $compilerFactory;
41 
50  public function __construct(
51  TemplateProvider $templateProvider,
55  ) {
56  $this->templateProvider = $templateProvider;
57  $this->resultFactory = $resultFactory;
58  $this->templateFactory = $templateFactory;
59  $this->compilerFactory = $compilerFactory;
60  }
61 
75  public function render(BlockInterface $block, $templateFile, array $dictionary = [])
76  {
78  $template = $this->templateFactory->create(['content' => $this->templateProvider->getTemplate($templateFile)]);
79 
80  $result = $this->resultFactory->create(
81  [
82  'template' => $template,
83  'compiler' => $this->compilerFactory->create(),
84  'component' => $block
85  ]
86  );
87 
88  return $result;
89  }
90 }
__construct(TemplateProvider $templateProvider, ResultFactory $resultFactory, TemplateFactory $templateFactory, CompilerFactory $compilerFactory)
Definition: Xhtml.php:50
$block
Definition: block.php:8
$template
Definition: export.php:12
render(\Magento\Framework\View\Element\BlockInterface $block, $templateFile, array $dictionary=[])