layoutFactory->create(); $html = $layout->createBlock(ViewBlock::class) ->setData('modal', true) ->toHtml(); return $this->resultFactory->create(ResultFactory::TYPE_RAW) ->setHeader('Content-Type', 'text/html; charset=UTF-8', true) ->setContents($html); } }