Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Config.php
Go to the documentation of this file.
1 <?php
7 
11 class Config
12 {
18  protected $_pageLayouts;
19 
23  protected $_dataStorage;
24 
30  public function __construct(\Magento\Framework\Config\DataInterface $dataStorage)
31  {
32  $this->_dataStorage = $dataStorage;
33  }
34 
40  protected function _initPageLayouts()
41  {
42  if ($this->_pageLayouts === null) {
43  $this->_pageLayouts = [];
44  foreach ($this->_dataStorage->get(null) as $layoutCode => $layoutConfig) {
45  $layoutConfig['label'] = __($layoutConfig['label']);
46  $this->_pageLayouts[$layoutCode] = new \Magento\Framework\DataObject($layoutConfig);
47  }
48  }
49  return $this;
50  }
51 
57  public function getPageLayouts()
58  {
59  $this->_initPageLayouts();
60  return $this->_pageLayouts;
61  }
62 
69  public function getPageLayout($layoutCode)
70  {
71  $this->_initPageLayouts();
72 
73  if (isset($this->_pageLayouts[$layoutCode])) {
74  return $this->_pageLayouts[$layoutCode];
75  }
76 
77  return false;
78  }
79 
85  public function getPageLayoutHandles()
86  {
87  $handles = [];
88 
89  foreach ($this->getPageLayouts() as $layout) {
90  $handles[$layout->getCode()] = $layout->getCode();
91  }
92 
93  return $handles;
94  }
95 }
__()
Definition: __.php:13
__construct(\Magento\Framework\Config\DataInterface $dataStorage)
Definition: Config.php:30