Reputation: 48
I need to add extra input into my contact form for specific localisation and I'm looking for a solution that could do something like this:
$form = $this->createFormBuilder()
->add(input)
if ($locale == "locale") {
->add(extrainput)
}
;
Insted of creating two form builders with if and else.
Upvotes: 1
Views: 768
Reputation: 125
add all of them, then you can do that :
$form = $this->createFormBuilder()
->add('input')
->add('extrainput')
->getForm();
if($test) {
$form->remove('extrainput');
}
Upvotes: 5