3
3
* Copyright © Magento, Inc. All rights reserved.
4
4
* See COPYING.txt for license details.
5
5
*/
6
+ declare (strict_types=1 );
6
7
7
- /**
8
- * Adminhtml catalog product action attribute update helper
9
- */
10
8
namespace Magento \Catalog \Helper \Product \Edit \Action ;
11
9
12
10
/**
13
- * Class Attribute
11
+ * Adminhtml catalog product action attribute update helper.
12
+ *
14
13
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
14
+ * @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
15
15
*/
16
16
class Attribute extends \Magento \Backend \Helper \Data
17
17
{
@@ -32,7 +32,7 @@ class Attribute extends \Magento\Backend\Helper\Data
32
32
/**
33
33
* Excluded from batch update attribute codes
34
34
*
35
- * @var string[]
35
+ * @var array
36
36
*/
37
37
protected $ _excludedAttributes = ['url_key ' ];
38
38
@@ -92,6 +92,7 @@ public function __construct(
92
92
93
93
/**
94
94
* Return product collection with selected product filter
95
+ *
95
96
* Product collection didn't load
96
97
*
97
98
* @return \Magento\Catalog\Model\ResourceModel\Product\Collection
@@ -171,8 +172,8 @@ public function getAttributes()
171
172
$ this ->getProductsSetIds ()
172
173
);
173
174
174
- if ($ this ->_excludedAttributes ) {
175
- $ this ->_attributes ->addFieldToFilter ('attribute_code ' , ['nin ' => $ this -> _excludedAttributes ]);
175
+ if ($ excludedAttributes = $ this ->getExcludedAttributes () ) {
176
+ $ this ->_attributes ->addFieldToFilter ('attribute_code ' , ['nin ' => $ excludedAttributes ]);
176
177
}
177
178
178
179
// check product type apply to limitation and remove attributes that impossible to change in mass-update
@@ -193,11 +194,24 @@ public function getAttributes()
193
194
}
194
195
195
196
/**
197
+ * Gets website id.
198
+ *
196
199
* @param int $storeId
197
200
* @return int
201
+ * @throws \Magento\Framework\Exception\NoSuchEntityException
198
202
*/
199
203
public function getStoreWebsiteId ($ storeId )
200
204
{
201
205
return $ this ->_storeManager ->getStore ($ storeId )->getWebsiteId ();
202
206
}
207
+
208
+ /**
209
+ * Retrieve excluded attributes.
210
+ *
211
+ * @return array
212
+ */
213
+ public function getExcludedAttributes (): array
214
+ {
215
+ return $ this ->_excludedAttributes ;
216
+ }
203
217
}
0 commit comments