97 private $entitySpecificHandlesList;
119 View\
Layout\ReaderPool $layoutReaderPool,
120 Framework\
Translate\InlineInterface $translateInline,
121 View\
Layout\BuilderFactory $layoutBuilderFactory,
129 $this->request = $context->getRequest();
130 $this->assetRepo = $context->getAssetRepository();
131 $this->logger = $context->getLogger();
132 $this->urlBuilder = $context->getUrlBuilder();
133 $this->pageConfig = $context->getPageConfig();
135 $this->viewFileSystem = $context->getViewFileSystem();
138 $this->entitySpecificHandlesList = $entitySpecificHandlesList
145 $layoutBuilderFactory,
159 $this->pageConfigRenderer = $this->pageConfigRendererFactory->create([
'pageConfig' => $this->pageConfig]);
169 $this->layoutBuilderFactory->create(View\
Layout\BuilderFactory::TYPE_PAGE, [
170 'layout' => $this->layout,
171 'pageConfig' => $this->pageConfig,
172 'pageLayoutReader' => $this->pageLayoutReader
183 $this->addHandle(
'default');
184 $this->addHandle($this->getDefaultLayoutHandle());
185 $update = $this->getLayout()->getUpdate();
186 if ($update->isLayoutDefined()) {
187 $update->removeHandle(
'default');
199 $this->addHandle(
'default');
200 return parent::addDefaultHandle();
223 $handle = $defaultHandle ? $defaultHandle : $this->getDefaultLayoutHandle();
225 foreach ($parameters as $key =>
$value) {
227 $pageHandles[] = $pageHandle;
228 if ($entitySpecific) {
229 $this->entitySpecificHandlesList->addHandle($pageHandle);
233 $this->addHandle($pageHandles);
242 $this->pageConfig->publicBuild();
246 $addBlock = $this->getLayout()->getBlock(
'head.additional');
247 $requireJs = $this->getLayout()->getBlock(
'require.js');
249 'requireJs' => $requireJs ? $requireJs->toHtml() :
null,
250 'headContent' => $this->pageConfigRenderer->renderHeadContent(),
251 'headAdditional' => $addBlock ? $addBlock->toHtml() :
null,
252 'htmlAttributes' => $this->pageConfigRenderer->renderElementAttributes($config::ELEMENT_TYPE_HTML),
253 'headAttributes' => $this->pageConfigRenderer->renderElementAttributes($config::ELEMENT_TYPE_HEAD),
254 'bodyAttributes' => $this->pageConfigRenderer->renderElementAttributes($config::ELEMENT_TYPE_BODY),
258 $output = $this->getLayout()->getOutput();
259 $this->
assign(
'layoutContent', $output);
261 $this->translateInline->processResponseBody(
$output);
276 $this->pageConfig->addBodyClass($this->request->getFullActionName(
'-'));
279 $this->pageConfig->addBodyClass(
'page-layout-' .
$pageLayout);
289 return $this->pageConfig->getPageLayout() ?: $this->getLayout()->getUpdate()->getPageLayout();
301 if (is_array($key)) {
302 foreach ($key as $subKey => $subValue) {
303 $this->
assign($subKey, $subValue);
306 $this->viewVars[$key] =
$value;
319 $fileName = $this->viewFileSystem->getTemplateFileName($this->
template);
321 throw new \InvalidArgumentException(
'Template "' . $this->
template .
'" is not found');
326 extract($this->viewVars, EXTR_SKIP);
328 }
catch (\Exception $exception) {
346 $params = array_merge([
'_secure' => $this->request->isSecure()],
$params);
347 return $this->assetRepo->getUrlWithParams($fileId,
$params);
349 $this->logger->critical($e);
350 return $this->urlBuilder->getUrl(
'', [
'_direct' =>
'core/index/notFound']);
getViewFileUrl($fileId, array $params=[])
render(HttpResponseInterface $response)
$pageConfigRendererFactory
__construct(View\Element\Template\Context $context, View\LayoutFactory $layoutFactory, View\Layout\ReaderPool $layoutReaderPool, Framework\Translate\InlineInterface $translateInline, View\Layout\BuilderFactory $layoutBuilderFactory, View\Layout\GeneratorPool $generatorPool, View\Page\Config\RendererFactory $pageConfigRendererFactory, View\Page\Layout\Reader $pageLayoutReader, $template, $isIsolated=false, View\EntitySpecificHandlesList $entitySpecificHandlesList=null)
addPageLayoutHandles(array $parameters=[], $defaultHandle=null, $entitySpecific=true)
assign($key, $value=null)
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]