16
16
*/
17
17
class Category extends \Magento \Framework \View \Element \AbstractBlock implements DataProviderInterface
18
18
{
19
- /**
20
- * @var \Magento\Framework\Config\View
21
- */
22
- private $ configView ;
23
-
24
- /**
19
+ /**
25
20
* @var \Magento\Catalog\Model\CategoryFactory
26
21
*/
27
22
protected $ categoryFactory ;
@@ -56,6 +51,16 @@ class Category extends \Magento\Framework\View\Element\AbstractBlock implements
56
51
*/
57
52
protected $ categoryRepository ;
58
53
54
+ /**
55
+ * @var \Magento\Framework\View\ConfigInterface
56
+ */
57
+ protected $ viewConfig ;
58
+
59
+ /**
60
+ * @var \Magento\Framework\Config\View
61
+ */
62
+ protected $ configView ;
63
+
59
64
/**
60
65
* @param \Magento\Framework\View\Element\Template\Context $context
61
66
* @param \Magento\Catalog\Model\CategoryFactory $categoryFactory
@@ -64,6 +69,7 @@ class Category extends \Magento\Framework\View\Element\AbstractBlock implements
64
69
* @param \Magento\Catalog\Helper\Image $imageHelper
65
70
* @param \Magento\Customer\Model\Session $customerSession
66
71
* @param CategoryRepositoryInterface $categoryRepository
72
+ * @param \Magento\Framework\View\ConfigInterface $viewConfig
67
73
* @param array $data
68
74
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
69
75
*/
@@ -75,6 +81,7 @@ public function __construct(
75
81
\Magento \Catalog \Helper \Image $ imageHelper ,
76
82
\Magento \Customer \Model \Session $ customerSession ,
77
83
CategoryRepositoryInterface $ categoryRepository ,
84
+ \Magento \Framework \View \ConfigInterface $ viewConfig ,
78
85
array $ data = []
79
86
) {
80
87
$ this ->imageHelper = $ imageHelper ;
@@ -84,6 +91,7 @@ public function __construct(
84
91
$ this ->rssUrlBuilder = $ rssUrlBuilder ;
85
92
$ this ->storeManager = $ context ->getStoreManager ();
86
93
$ this ->categoryRepository = $ categoryRepository ;
94
+ $ this ->viewConfig = $ viewConfig ;
87
95
parent ::__construct ($ context , $ data );
88
96
}
89
97
@@ -124,7 +132,7 @@ public function getRssData()
124
132
125
133
$ attributes = $ this ->getConfigView ()
126
134
->getMediaAttributes ('Magento_Catalog ' , $ this ->imageHelper ::MEDIA_TYPE_CONFIG_NODE , 'rss_thumbnail ' );
127
-
135
+
128
136
/** @var $product \Magento\Catalog\Model\Product */
129
137
foreach ($ this ->rssModel ->getProductCollection ($ category , $ this ->getStoreId ()) as $ product ) {
130
138
$ product ->setAllowedInRss (true );
@@ -275,12 +283,14 @@ public function isAuthRequired()
275
283
}
276
284
277
285
/**
286
+ * Retrieve config view
287
+ *
278
288
* @return \Magento\Framework\Config\View
279
289
*/
280
- private function getConfigView ()
290
+ protected function getConfigView ()
281
291
{
282
292
if (!$ this ->configView ) {
283
- $ this ->configView = $ this ->_viewConfig ->getViewConfig ();
293
+ $ this ->configView = $ this ->viewConfig ->getViewConfig ();
284
294
}
285
295
return $ this ->configView ;
286
296
}
0 commit comments