Sylius\Bundle\PromotionBundle\Form\Type\PromotionType::buildForm PHP Method

buildForm() public method

public buildForm ( Symfony\Component\Form\FormBuilderInterface $builder, array $options )
$builder Symfony\Component\Form\FormBuilderInterface
$options array
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('name', TextType::class, ['label' => 'sylius.form.promotion.name'])->add('description', TextareaType::class, ['label' => 'sylius.form.promotion.description', 'required' => false])->add('exclusive', CheckboxType::class, ['label' => 'sylius.form.promotion.exclusive'])->add('usageLimit', IntegerType::class, ['label' => 'sylius.form.promotion.usage_limit', 'required' => false])->add('startsAt', DateTimeType::class, ['label' => 'sylius.form.promotion.starts_at', 'date_widget' => 'single_text', 'time_widget' => 'single_text', 'required' => false])->add('endsAt', DateTimeType::class, ['label' => 'sylius.form.promotion.ends_at', 'date_widget' => 'single_text', 'time_widget' => 'single_text', 'required' => false])->add('priority', IntegerType::class, ['label' => 'sylius.form.promotion.priority', 'required' => false])->add('couponBased', CheckboxType::class, ['label' => 'sylius.form.promotion.coupon_based', 'required' => false])->add('rules', PromotionRuleCollectionType::class, ['label' => 'sylius.form.promotion.rules', 'button_add_label' => 'sylius.form.promotion.add_rule'])->add('actions', PromotionActionCollectionType::class, ['label' => 'sylius.form.promotion.actions', 'button_add_label' => 'sylius.form.promotion.add_action'])->addEventSubscriber(new AddCodeFormSubscriber());
    }

Usage Example

Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     parent::buildForm($builder, $options);
     $builder->add('channels', 'sylius_channel_choice', array('multiple' => true, 'expanded' => true, 'label' => 'sylius.form.promotion.channels'));
 }