/**
  * Customize the attribute form
  *
  * @param Form              $form
  * @param AbstractAttribute $attribute
  */
 protected function customizeForm(Form $form, AbstractAttribute $attribute)
 {
     $attTypeClass = $this->attTypeFactory->get($attribute->getAttributeType());
     $fields = $attTypeClass->buildAttributeFormTypes($this->factory, $attribute);
     foreach ($fields as $field) {
         $form->add($field);
     }
 }
 /**
  * @param ProductValueInterface $value
  * @param array                 $context
  *
  * @return FormInterface
  */
 public function buildProductValueForm(ProductValueInterface $value, array $context)
 {
     $attributeTypeAlias = $value->getAttribute()->getAttributeType();
     $attributeType = $this->attributeTypeFactory->get($attributeTypeAlias);
     $name = $attributeType->prepareValueFormName($value);
     $type = $attributeType->prepareValueFormAlias($value);
     $data = $attributeType->prepareValueFormData($value);
     $options = array_merge($attributeType->prepareValueFormConstraints($value), $attributeType->prepareValueFormOptions($value));
     $event = new CreateProductValueFormEvent($value, $type, $data, $options, $context);
     $this->eventDispatcher->dispatch(ProductEvents::CREATE_VALUE_FORM, $event);
     $valueForm = $this->formFactory->createNamed($name, $event->getFormType(), $event->getFormData(), $event->getFormOptions());
     return $valueForm;
 }
 /**
  * Get a list of available attribute types
  *
  * @return string[]
  */
 public function getAttributeTypes()
 {
     $types = $this->factory->getAttributeTypes($this->productClass);
     $choices = array();
     foreach ($types as $type) {
         $choices[$type] = $type;
     }
     asort($choices);
     return $choices;
 }