/** * Prepare option values of user defined attribute * * @codeCoverageIgnore * @param array|\Magento\Eav\Model\ResourceModel\Entity\Attribute\Option $option * @param string $inputType * @param array $defaultValues * @return array */ protected function _prepareUserDefinedAttributeOptionValues($option, $inputType, $defaultValues) { $optionId = $option->getId(); $value['checked'] = in_array($optionId, $defaultValues) ? 'checked="checked"' : ''; $value['intype'] = $inputType; $value['id'] = $optionId; $value['sort_order'] = $option->getSortOrder(); foreach ($this->getStores() as $store) { $value = array_merge($value, $this->createStoreValues($store->getId(), $optionId)); } return [$value]; }
/** * Prepare option values of user defined attribute * * @param array|\Magento\Eav\Model\ResourceModel\Entity\Attribute\Option $option * @param string $inputType * @param array $defaultValues * @return array */ protected function _prepareUserDefinedAttributeOptionValues($option, $inputType, $defaultValues) { $optionId = $option->getId(); $value['checked'] = in_array($optionId, $defaultValues) ? 'checked="checked"' : ''; $value['intype'] = $inputType; $value['id'] = $optionId; $value['sort_order'] = $option->getSortOrder(); foreach ($this->getStores() as $store) { $storeId = $store->getId(); $storeValues = $this->getStoreOptionValues($storeId); $value['store' . $storeId] = isset($storeValues[$optionId]) ? $this->escapeHtml($storeValues[$optionId]) : ''; } return [$value]; }