/** * Prepare attribute view * * @param AttributeInterface $attribute * @param ProductValueInterface $value * @param FormView $view * * @return array */ protected function prepareAttributeView(AttributeInterface $attribute, ProductValueInterface $value, FormView $view) { $attributeView = ['id' => $attribute->getId(), 'isRemovable' => $value->isRemovable(), 'code' => $attribute->getCode(), 'label' => $attribute->getLabel(), 'sortOrder' => $attribute->getSortOrder(), 'allowValueCreation' => in_array($attribute->getAttributeType(), $this->choiceAttributeTypes), 'locale' => $value->getLocale()]; if ($attribute->isScopable()) { $attributeView['values'] = array_merge($this->getAttributeValues($attribute, $value->getLocale()), [$value->getScope() => $view]); ksort($attributeView['values']); } else { $attributeView['value'] = $view; } $classes = $this->getAttributeClasses($attribute); if (!empty($classes)) { $attributeView['classes'] = $classes; } return $attributeView; }