Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     parent::buildForm($builder, $options);
     $builder->add('requirement', 'choice', array('label' => 'Requirement', 'choices' => Attribute::getRequirementLabels(), 'expanded' => true))->add('filter', 'choice', array('label' => 'Filter', 'choices' => Attribute::getFilterLabels()))->addEventSubscriber(new FrontendWidgetFormSubscriber())->addEventSubscriber(new BackendWidgetFormSubscriber());
 }
 /**
  * @param FormInterface $form
  * @param Attribute $attribute
  */
 private function addValueField(FormInterface $form, Attribute $attribute)
 {
     $options = array('auto_initialize' => false, 'label' => $attribute->getName());
     $form->add('value', sprintf('sylius_attribute_type_%s_%s', $attribute->getType(), $attribute->getBewWidgetByArchetype($this->archetype)), $options);
 }