21
21
use Magento \Framework \App \RequestInterface ;
22
22
use Magento \Framework \Filter \Translit ;
23
23
use Magento \Store \Model \StoreManagerInterface ;
24
- use Magento \Ui \Component \Form \Element \Checkbox ;
25
24
use Magento \Ui \Component \Form \Field ;
26
25
use Magento \Ui \Component \Form \Fieldset ;
27
26
use Magento \Ui \DataProvider \EavValidationRules ;
28
27
use Magento \Ui \DataProvider \Mapper \FormElement as FormElementMapper ;
29
28
use Magento \Ui \DataProvider \Mapper \MetaProperties as MetaPropertiesMapper ;
29
+ use Magento \Ui \Component \Form \Element \Wysiwyg as WysiwygElement ;
30
30
31
31
/**
32
32
* Class Eav
@@ -225,7 +225,7 @@ protected function getAttributesMeta(array $attributes, $groupCode)
225
225
226
226
$ child = $ this ->setupMetaProperties ($ attribute );
227
227
228
- $ meta [' container_ ' . $ code ] = [
228
+ $ meta [static :: CONTAINER_PREFIX . $ code ] = [
229
229
'arguments ' => [
230
230
'data ' => [
231
231
'config ' => [
@@ -240,6 +240,11 @@ protected function getAttributesMeta(array $attributes, $groupCode)
240
240
],
241
241
];
242
242
243
+ if ($ attribute ->getIsWysiwygEnabled ()) {
244
+ $ meta [static ::CONTAINER_PREFIX . $ code ]['arguments ' ]['data ' ]['config ' ]['component ' ] =
245
+ 'Magento_Ui/js/form/components/group ' ;
246
+ }
247
+
243
248
$ child ['arguments ' ]['data ' ]['config ' ]['code ' ] = $ code ;
244
249
$ child ['arguments ' ]['data ' ]['config ' ]['source ' ] = $ groupCode ;
245
250
$ child ['arguments ' ]['data ' ]['config ' ]['scopeLabel ' ] = $ this ->getScopeLabel ($ attribute );
@@ -456,6 +461,27 @@ protected function setupMetaProperties(ProductAttributeInterface $attribute)
456
461
$ meta ['arguments ' ]['data ' ]['config ' ]['options ' ] = $ attributeModel ->getSource ()->getAllOptions ();
457
462
}
458
463
464
+ $ meta = $ this ->addWysiwyg ($ attribute , $ meta );
465
+
466
+ return $ meta ;
467
+ }
468
+
469
+ /**
470
+ * Add wysiwyg properties
471
+ *
472
+ * @param ProductAttributeInterface $attribute
473
+ * @param array $meta
474
+ * @return array
475
+ */
476
+ private function addWysiwyg (ProductAttributeInterface $ attribute , array $ meta )
477
+ {
478
+ if (!$ attribute ->getIsWysiwygEnabled ()) {
479
+ return $ meta ;
480
+ }
481
+
482
+ $ meta ['arguments ' ]['data ' ]['config ' ]['formElement ' ] = WysiwygElement::NAME ;
483
+ $ meta ['arguments ' ]['data ' ]['config ' ]['wysiwyg ' ] = true ;
484
+
459
485
return $ meta ;
460
486
}
461
487
0 commit comments