urnResolver = $urnResolver; parent::__construct($configFiles, $domFactory); } /** * Get absolute path to the XML-schema file * * @return string */ public function getSchemaFile() { return $this->urnResolver->getRealPath('urn:magento:framework:View/PageLayout/etc/layouts.xsd'); } /** * Get page layout that contains declared in system * * @return string[][] */ public function getPageLayouts() { return $this->_data; } /** * Checks that the page layout declared in configuration * * @param string $pageLayout * @return bool */ public function hasPageLayout($pageLayout) { return isset($this->_data[$pageLayout]); } /** * Retrieve page layout options * * @return array */ public function getOptions() { return $this->getPageLayouts(); } /** * @param bool $withEmpty * @return array */ public function toOptionArray($withEmpty = false) { $options = []; foreach ($this->getPageLayouts() as $value => $label) { $options[] = ['label' => $label, 'value' => $value]; } if ($withEmpty) { array_unshift($options, [ 'value' => '', 'label' => (string)new \Magento\Framework\Phrase('-- Please Select --') ]); } return $options; } /** * Extract configuration data from the DOM structure * * @param \DOMDocument $dom * @return array */ protected function _extractData(\DOMDocument $dom) { $result = []; /** @var \DOMElement $layout */ foreach ($dom->getElementsByTagName('layout') as $layout) { $result[$layout->getAttribute('id')] = trim($layout->nodeValue); } return $result; } /** * Get XML-contents, initial for merging * * @return string */ protected function _getInitialXml() { return '' . ''; } /** * Get list of paths to identifiable nodes * * @return array */ protected function _getIdAttributes() { return [ '/page_layouts/layout' => 'id' ]; } }