Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Navigation.php
Go to the documentation of this file.
1 <?php
7 namespace Magento\Setup\Model;
8 
9 use Zend\ServiceManager\ServiceLocatorInterface;
11 
13 {
17  const NAV_INSTALLER = 'navInstaller';
18  const NAV_UPDATER = 'navUpdater';
22  private $navStates;
23 
27  private $navType;
28 
32  private $titles;
33 
38  public function __construct(ServiceLocatorInterface $serviceLocator, DeploymentConfig $deploymentConfig)
39  {
40  if ($deploymentConfig->isAvailable()) {
41  $this->navStates = $serviceLocator->get('config')[self::NAV_UPDATER];
42  $this->navType = self::NAV_UPDATER;
43  $this->titles = $serviceLocator->get('config')[self::NAV_UPDATER . 'Titles'];
44  } else {
45  $this->navStates = $serviceLocator->get('config')[self::NAV_INSTALLER];
46  $this->navType = self::NAV_INSTALLER;
47  $this->titles = $serviceLocator->get('config')[self::NAV_INSTALLER . 'Titles'];
48  }
49  }
50 
54  public function getType()
55  {
56  return $this->navType;
57  }
58 
62  public function getData()
63  {
64  return $this->navStates;
65  }
66 
74  public function getMenuItems()
75  {
76  return array_values(array_filter(
77  $this->navStates,
78  function ($value) {
79  return isset($value['nav']) && (bool)$value['nav'];
80  }
81  ));
82  }
83 
91  public function getMainItems()
92  {
93  $result = array_values(array_filter(
94  $this->navStates,
95  function ($value) {
96  return isset($value['main']) && (bool)$value['main'];
97  }
98  ));
99  return $result;
100  }
101 
107  public function getTitles()
108  {
109  return $this->titles;
110  }
111 }
$deploymentConfig
$value
Definition: gender.phtml:16
__construct(ServiceLocatorInterface $serviceLocator, DeploymentConfig $deploymentConfig)
Definition: Navigation.php:38