formFactory = $formFactory; $this->urlGenerator = $urlGenerator; } public function getFunctions() { return array( new TwigFunction('carac_form_switch_merchant', [$this, 'getFormSwitchMerchant']), new TwigFunction('carac_form_switch_section', [$this, 'getFormSwitchSection']), ); } public function getFormSwitchMerchant($context = 'front', $actionRoute = 'carac_merchant_switch', $csrfProtection = true) { $form = $this->formFactory->create( SwitchMerchantFormType::class, null, [ 'action' => $this->urlGenerator->generate($actionRoute), 'attr' => ['class' => 'switch-merchant'], 'csrf_protection' => $csrfProtection, 'context' => $context ] ); return $form->createView(); } public function getFormSwitchSection() { $form = $this->formFactory->create( SwitchSectionFormType::class, null, [ 'action' => $this->urlGenerator->generate('admin_section_switch'), 'attr' => ['class' => 'switch-section'] ] ); return $form->createView(); } }