File tree Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Plugin for \Magento\Catalog\Model\Product\Attribute\Repository
4
+ *
5
+ * Copyright © 2015 Magento. All rights reserved.
6
+ * See COPYING.txt for license details.
7
+ */
8
+ namespace Magento \Catalog \Model \Plugin ;
9
+
10
+ use Magento \Catalog \Model \Product \Attribute \Repository ;
11
+
12
+ class FilterCustomAttribute
13
+ {
14
+ /**
15
+ * @var array
16
+ */
17
+ private $ blackList ;
18
+
19
+ /**
20
+ * @param array $blackList
21
+ */
22
+ public function __construct (array $ blackList = [])
23
+ {
24
+ $ this ->blackList = $ blackList ;
25
+ }
26
+
27
+ /**
28
+ * Delete custom attribute
29
+ *
30
+ * @param Repository $repository
31
+ * @param array $attributes
32
+ * @return \Magento\Eav\Model\AttributeRepository
33
+ *
34
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
35
+ */
36
+ public function afterGetCustomAttributesMetadata (Repository $ repository , array $ attributes )
37
+ {
38
+ foreach ($ attributes as $ key => $ attribute ) {
39
+ if (in_array ($ attribute ->getAttributeCode (), $ this ->blackList )) {
40
+ unset($ attributes [$ key ]);
41
+ }
42
+ }
43
+
44
+ return $ attributes ;
45
+ }
46
+ }
Original file line number Diff line number Diff line change 46
46
<type name =" Magento\Customer\Model\ResourceModel\Visitor" >
47
47
<plugin name =" catalogLog" type =" Magento\Catalog\Model\Plugin\Log" />
48
48
</type >
49
+ <type name =" Magento\Catalog\Model\Product\Attribute\Repository" >
50
+ <plugin name =" filterCustomAttribute" type =" Magento\Catalog\Model\Plugin\FilterCustomAttribute" />
51
+ </type >
52
+ <type name =" Magento\Catalog\Model\Plugin\FilterCustomAttribute" >
53
+ <arguments >
54
+ <argument name =" blackList" xsi : type =" array" >
55
+ <item name =" quantity_and_stock_status" xsi : type =" string" >quantity_and_stock_status</item >
56
+ </argument >
57
+ </arguments >
58
+ </type >
49
59
<type name =" Magento\Indexer\Model\Indexer\State" >
50
60
<plugin name =" setStatusForIndexer" type =" Magento\Catalog\Model\Indexer\Category\Product\Plugin\IndexerState" />
51
61
</type >
You can’t perform that action at this time.
0 commit comments