File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Model/Validator/Attribute
Test/Unit/Model/Validator/Attribute Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 7
7
8
8
namespace Magento \Eav \Model \Validator \Attribute ;
9
9
10
+ use Magento \Catalog \Ui \DataProvider \Product \Form \Modifier \AbstractModifier ;
10
11
use Magento \Eav \Model \Entity \Attribute ;
11
12
use Magento \Framework \Exception \LocalizedException ;
12
13
use Magento \Framework \Validator \AbstractValidator ;
@@ -65,6 +66,16 @@ public function isValid($attributeCode): bool
65
66
);
66
67
}
67
68
69
+ /**
70
+ * Check attribute_code for prohibited prefix
71
+ */
72
+ if (strpos ($ attributeCode , AbstractModifier::CONTAINER_PREFIX ) === 0 ) {
73
+ $ errorMessages [] = __ (
74
+ '"%1" prefix is reserved by the system and cannot be used in attribute code names. ' ,
75
+ AbstractModifier::CONTAINER_PREFIX
76
+ );
77
+ }
78
+
68
79
$ this ->_addMessages ($ errorMessages );
69
80
70
81
return !$ this ->hasMessages ();
Original file line number Diff line number Diff line change @@ -61,7 +61,10 @@ public function isValidDataProvider(): array
61
61
], [
62
62
'more_than_60_chars_more_than_60_chars_more_than_60_chars_more ' ,
63
63
false
64
- ]
64
+ ], [
65
+ 'container_attribute ' ,
66
+ false ,
67
+ ],
65
68
];
66
69
}
67
70
}
You can’t perform that action at this time.
0 commit comments