Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- final class WholesaleRulesetType extends AbstractResourceType
- {
- public function buildForm(FormBuilderInterface $builder, array $options): void
- {
- $builder
- ->add(
- 'name',
- TextType::class,
- [
- 'label' => 'skyboundtech_sylius_wholesale_suite_plugin.ui.wholesale_rulesets.ruleset_name',
- ]
- )
- ->add(
- 'description',
- TextareaType::class,
- [
- 'label' => 'skyboundtech_sylius_wholesale_suite_plugin.ui.wholesale_rulesets.ruleset_description',
- ]
- )
- ->add(
- 'enabled',
- null,
- [
- 'label' => 'Enabled?',
- ]
- )
- ->add(
- 'quantityStepRules',
- CollectionType::class,
- [
- 'entry_type' => WholesaleRuleQuantityStepByTaxonType::class,
- 'allow_add' => true,
- 'allow_delete' => true,
- 'by_reference' => false,
- ]
- );
- $builder->addEventListener(
- FormEvents::PRE_SUBMIT,
- function (FormEvent $event) {
- $data = $event->getData();
- $quantityStepRules = &$data['quantityStepRules'];
- foreach ($quantityStepRules as $key => $quantityStepRule) {
- $quantityStepRules[$key]['scope'] = 'taxonomy';
- }
- $event->setData($data);
- }
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement