File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -472,11 +472,32 @@ protected function setupMetaProperties(ProductAttributeInterface $attribute)
472472 }
473473
474474 $ meta = $ this ->addWysiwyg ($ attribute , $ meta );
475+ $ meta = $ this ->customizeCheckbox ($ attribute , $ meta );
475476 $ meta = $ this ->customizePriceAttribute ($ attribute , $ meta );
476477
477478 return $ meta ;
478479 }
479480
481+ /**
482+ * Customize checkboxes
483+ *
484+ * @param ProductAttributeInterface $attribute
485+ * @param array $meta
486+ * @return array
487+ */
488+ private function customizeCheckbox (ProductAttributeInterface $ attribute , array $ meta )
489+ {
490+ if ($ attribute ->getFrontendInput () === 'boolean ' ) {
491+ $ meta ['arguments ' ]['data ' ]['config ' ]['prefer ' ] = 'toggle ' ;
492+ $ meta ['arguments ' ]['data ' ]['config ' ]['valueMap ' ] = [
493+ 'true ' => '1 ' ,
494+ 'false ' => '0 ' ,
495+ ];
496+ }
497+
498+ return $ meta ;
499+ }
500+
480501 /**
481502 * Customize attribute that has price type
482503 *
You can’t perform that action at this time.
0 commit comments