7
7
8
8
use Magento \Framework \App \Action \HttpGetActionInterface ;
9
9
use Magento \Backend \App \Action \Context ;
10
+ use Magento \Framework \App \ObjectManager ;
11
+ use Magento \Framework \App \Request \DataPersistorInterface ;
10
12
use Magento \Framework \View \Result \PageFactory ;
11
13
12
14
/**
@@ -26,16 +28,24 @@ class Index extends \Magento\Backend\App\Action implements HttpGetActionInterfac
26
28
*/
27
29
protected $ resultPageFactory ;
28
30
31
+ /**
32
+ * @var DataPersistorInterface
33
+ */
34
+ private $ dataPersistor ;
35
+
29
36
/**
30
37
* @param Context $context
31
38
* @param PageFactory $resultPageFactory
39
+ * @param DataPersistorInterface $dataPersistor
32
40
*/
33
41
public function __construct (
34
42
Context $ context ,
35
- PageFactory $ resultPageFactory
43
+ PageFactory $ resultPageFactory ,
44
+ DataPersistorInterface $ dataPersistor = null
36
45
) {
37
46
parent ::__construct ($ context );
38
47
$ this ->resultPageFactory = $ resultPageFactory ;
48
+ $ this ->dataPersistor = $ dataPersistor ?: ObjectManager::getInstance ()->get (DataPersistorInterface::class);
39
49
}
40
50
41
51
/**
@@ -52,8 +62,7 @@ public function execute()
52
62
$ resultPage ->addBreadcrumb (__ ('Manage Pages ' ), __ ('Manage Pages ' ));
53
63
$ resultPage ->getConfig ()->getTitle ()->prepend (__ ('Pages ' ));
54
64
55
- $ dataPersistor = $ this ->_objectManager ->get (\Magento \Framework \App \Request \DataPersistorInterface::class);
56
- $ dataPersistor ->clear ('cms_page ' );
65
+ $ this ->dataPersistor ->clear ('cms_page ' );
57
66
58
67
return $ resultPage ;
59
68
}
0 commit comments