Skip to content

Instantly share code, notes, and snippets.

@Raistlfiren
Created December 21, 2015 17:31
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Raistlfiren/7ddc0d10ff17b6ff022e to your computer and use it in GitHub Desktop.
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
Copy link

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