themeResolver = $themeResolver; $this->processorFactory = $processorFactory; $this->pageLayoutFileSource = $pageLayoutFileSource; $this->reader = $reader; } /** * Retrieve the layout update instance * * @return \Magento\Framework\View\Layout\ProcessorInterface */ protected function getPageLayoutMerge() { if ($this->pageLayoutMerge) { return $this->pageLayoutMerge; } $this->pageLayoutMerge = $this->processorFactory->create([ 'theme' => $this->themeResolver->get(), 'fileSource' => $this->pageLayoutFileSource, 'cacheSuffix' => self::MERGE_CACHE_SUFFIX, ]); return $this->pageLayoutMerge; } /** * Read page layout structure and fill reader context * * @param Layout\Reader\Context $readerContext * @param string $pageLayout * @return void */ public function read(Layout\Reader\Context $readerContext, $pageLayout) { $this->getPageLayoutMerge()->load($pageLayout); $xml = $this->getPageLayoutMerge()->asSimplexml(); $this->reader->interpret($readerContext, $xml); } }