Skip to content

Instantly share code, notes, and snippets.

@Raistlfiren
Created Dec 21, 2015
Embed
What would you like to do?
form
<?php
public function buildForm(FormBuilderInterface $builder, array $options)
{
if ($options['required']) {
$placeholder = 'test';
} else {
$placeholder = 'nope';
}
$builder
->add('email', 'email', array('label' => 'form.email', 'translation_domain' => 'FOSUserBundle'))
->add('username', null, array('label' => 'form.username', 'translation_domain' => 'FOSUserBundle'))
->add('firstName', null, array('label' => 'form.firstname'))
->add('lastName', null, array('label' => 'form.lastname'))
->add('address1', null, array('label' => 'form.fax'))
->add('city', null, array('label' => 'form.city'))
->add('state', null, array('label' => 'form.state'))
->add('zipcode', null, array('label' => 'form.zipcode'))
->add('primaryPhone', null, array('label' => 'form.primaryPhone'))
->add('altPhone', null, array('label' => 'form.altPhone'))
;
$builder->addEventSubscriber(new PasswordFieldSubscriber());
}
@ClementNerma

This comment has been minimized.

Copy link

@ClementNerma ClementNerma commented Dec 21, 2015

Very useful when I don't want to create a new form. Thanks guy !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment