templateProvider = $templateProvider; $this->resultFactory = $resultFactory; $this->templateFactory = $templateFactory; $this->compilerFactory = $compilerFactory; } /** * Render template * * Render the named template in the context of a particular block and with * the data provided in $vars. * * @param BlockInterface $block * @param string $templateFile * @param array $dictionary * @return ResultInterface * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function render(BlockInterface $block, $templateFile, array $dictionary = []) { /** @var Template $template */ $template = $this->templateFactory->create(['content' => $this->templateProvider->getTemplate($templateFile)]); $result = $this->resultFactory->create( [ 'template' => $template, 'compiler' => $this->compilerFactory->create(), 'component' => $block ] ); return $result; } }