Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Converter.php
Go to the documentation of this file.
1 <?php
9 
11 {
15  public function convert($source)
16  {
17  $pageLayouts = [];
18  $xpath = new \DOMXPath($source);
19 
21  foreach ($xpath->query('/page_layouts/layout') as $layout) {
22  $layoutAttributes = $layout->attributes;
23  $id = $layoutAttributes->getNamedItem('id')->nodeValue;
24  $pageLayouts[$id]['code'] = $id;
25 
27  foreach ($layout->childNodes as $layoutSubNode) {
28  switch ($layoutSubNode->nodeName) {
29  case 'label':
30  $pageLayouts[$id][$layoutSubNode->nodeName] = $layoutSubNode->nodeValue;
31  break;
32  default:
33  break;
34  }
35  }
36  }
37  return $pageLayouts;
38  }
39 }
$id
Definition: fieldset.phtml:14
$source
Definition: source.php:23