@@ -62,6 +62,11 @@ class StaticField implements FieldProviderInterface
62
62
*/
63
63
private $ fieldNameResolver ;
64
64
65
+ /**
66
+ * @var array
67
+ */
68
+ private $ excludedAttributes ;
69
+
65
70
/**
66
71
* @param Config $eavConfig
67
72
* @param FieldTypeConverterInterface $fieldTypeConverter
@@ -70,6 +75,7 @@ class StaticField implements FieldProviderInterface
70
75
* @param FieldIndexResolver $fieldIndexResolver
71
76
* @param AttributeProvider $attributeAdapterProvider
72
77
* @param FieldName\ResolverInterface|null $fieldNameResolver
78
+ * @param array $excludedAttributes
73
79
*/
74
80
public function __construct (
75
81
Config $ eavConfig ,
@@ -78,7 +84,8 @@ public function __construct(
78
84
FieldTypeResolver $ fieldTypeResolver ,
79
85
FieldIndexResolver $ fieldIndexResolver ,
80
86
AttributeProvider $ attributeAdapterProvider ,
81
- FieldName \ResolverInterface $ fieldNameResolver = null
87
+ FieldName \ResolverInterface $ fieldNameResolver = null ,
88
+ array $ excludedAttributes = []
82
89
) {
83
90
$ this ->eavConfig = $ eavConfig ;
84
91
$ this ->fieldTypeConverter = $ fieldTypeConverter ;
@@ -88,6 +95,7 @@ public function __construct(
88
95
$ this ->attributeAdapterProvider = $ attributeAdapterProvider ;
89
96
$ this ->fieldNameResolver = $ fieldNameResolver ?: ObjectManager::getInstance ()
90
97
->get (FieldName \ResolverInterface::class);
98
+ $ this ->excludedAttributes = $ excludedAttributes ;
91
99
}
92
100
93
101
/**
@@ -103,6 +111,9 @@ public function getFields(array $context = []): array
103
111
$ allAttributes = [];
104
112
105
113
foreach ($ attributes as $ attribute ) {
114
+ if (in_array ($ attribute ->getAttributeCode (), $ this ->excludedAttributes , true )) {
115
+ continue ;
116
+ }
106
117
$ attributeAdapter = $ this ->attributeAdapterProvider ->getByAttributeCode ($ attribute ->getAttributeCode ());
107
118
$ fieldName = $ this ->fieldNameResolver ->getFieldName ($ attributeAdapter );
108
119
0 commit comments