/** * Setup attribute container meta * * @param ProductAttributeInterface $attribute * @return array * @api */ public function setupAttributeContainerMeta(ProductAttributeInterface $attribute) { $containerMeta = $this->arrayManager->set('arguments/data/config', [], ['formElement' => 'container', 'componentType' => 'container', 'breakLine' => false, 'label' => $attribute->getDefaultFrontendLabel(), 'required' => $attribute->getIsRequired()]); if ($attribute->getIsWysiwygEnabled()) { $containerMeta = $this->arrayManager->merge('arguments/data/config', $containerMeta, ['component' => 'Magento_Ui/js/form/components/group']); } return $containerMeta; }
/** * Initial meta setup * * @param ProductAttributeInterface $attribute * @return array * @throws \Magento\Framework\Exception\LocalizedException */ protected function setupMetaProperties(ProductAttributeInterface $attribute) { $meta = ['arguments' => ['data' => ['config' => ['dataType' => $attribute->getFrontendInput(), 'formElement' => $this->getFormElementsMapValue($attribute->getFrontendInput()), 'visible' => $attribute->getIsVisible(), 'required' => $attribute->getIsRequired(), 'notice' => $attribute->getNote(), 'default' => $attribute->getDefaultValue(), 'label' => __('%1', $attribute->getDefaultFrontendLabel())]]]]; foreach ($meta as $key => $value) { if ($value === null) { unset($meta[$key]); } } // TODO: Refactor to $attribute->getOptions() when MAGETWO-48289 is done $attributeModel = $this->getAttributeModel($attribute); if ($attributeModel->usesSource()) { $meta['arguments']['data']['config']['options'] = $attributeModel->getSource()->getAllOptions(); } $meta = $this->addWysiwyg($attribute, $meta); $meta = $this->customizeCheckbox($attribute, $meta); $meta = $this->customizePriceAttribute($attribute, $meta); $meta = $this->addUseDefaultValueCheckbox($attribute, $meta); return $meta; }