15
15
use Zend \View \Model \ViewModel ;
16
16
17
17
/**
18
- * Class Navigation
19
- *
18
+ * Controller Navigation class
20
19
*/
21
20
class Navigation extends AbstractActionController
22
21
{
@@ -35,6 +34,11 @@ class Navigation extends AbstractActionController
35
34
*/
36
35
protected $ view ;
37
36
37
+ /**
38
+ * @var JsonModel
39
+ */
40
+ protected $ json ;
41
+
38
42
/**
39
43
* @var ObjectManagerProvider $objectManagerProvider
40
44
*/
@@ -43,13 +47,22 @@ class Navigation extends AbstractActionController
43
47
/**
44
48
* @param NavModel $navigation
45
49
* @param Status $status
50
+ * @param ViewModel $viewModel
51
+ * @param JsonModel $jsonModel
52
+ * @param ObjectManagerProvider $objectManagerProvider
46
53
*/
47
- public function __construct (NavModel $ navigation , Status $ status , ObjectManagerProvider $ objectManagerProvider )
48
- {
54
+ public function __construct (
55
+ NavModel $ navigation ,
56
+ Status $ status ,
57
+ ViewModel $ viewModel ,
58
+ JsonModel $ jsonModel ,
59
+ ObjectManagerProvider $ objectManagerProvider
60
+ ) {
49
61
$ this ->navigation = $ navigation ;
50
62
$ this ->status = $ status ;
51
- $ this ->objectManagerProvider = $ objectManagerProvider ;
52
- $ this ->view = new ViewModel ();
63
+ $ this ->objectManagerProvider = $ objectManagerProvider ->get ();
64
+ $ this ->view = $ viewModel ;
65
+ $ this ->json = $ jsonModel ;
53
66
$ this ->view ->setVariable ('menu ' , $ this ->navigation ->getMenuItems ());
54
67
$ this ->view ->setVariable ('main ' , $ this ->navigation ->getMainItems ());
55
68
}
@@ -59,12 +72,11 @@ public function __construct(NavModel $navigation, Status $status, ObjectManagerP
59
72
*/
60
73
public function indexAction ()
61
74
{
62
- $ json = new JsonModel ();
63
- $ json ->setVariable ('nav ' , $ this ->navigation ->getData ());
64
- $ json ->setVariable ('menu ' , $ this ->navigation ->getMenuItems ());
65
- $ json ->setVariable ('main ' , $ this ->navigation ->getMainItems ());
66
- $ json ->setVariable ('titles ' , $ this ->navigation ->getTitles ());
67
- return $ json ;
75
+ $ this ->json ->setVariable ('nav ' , $ this ->navigation ->getData ());
76
+ $ this ->json ->setVariable ('menu ' , $ this ->navigation ->getMenuItems ());
77
+ $ this ->json ->setVariable ('main ' , $ this ->navigation ->getMainItems ());
78
+ $ this ->json ->setVariable ('titles ' , $ this ->navigation ->getTitles ());
79
+ return $ this ->json ;
68
80
}
69
81
70
82
/**
@@ -86,7 +98,7 @@ public function menuAction()
86
98
public function sideMenuAction ()
87
99
{
88
100
/** @var UrlInterface $backendUrl */
89
- $ backendUrl = $ this ->objectManagerProvider ->get ()-> get ( UrlInterface::class);
101
+ $ backendUrl = $ this ->objectManagerProvider ->get (UrlInterface::class);
90
102
91
103
$ this ->view ->setTemplate ('/magento/setup/navigation/side-menu.phtml ' );
92
104
$ this ->view ->setVariable ('isInstaller ' , $ this ->navigation ->getType () == NavModel::NAV_INSTALLER );
0 commit comments