| 1 | <?php |
| 2 | |
| 3 | namespace Mixstore\UserBundle\Form\Type; |
| 4 | |
| 5 | use Symfony\Component\Form\FormBuilderInterface; |
| 6 | use FOS\UserBundle\Form\Type\ProfileFormType as BaseType; |
| 7 | use Symfony\Component\Security\Core\SecurityContext; |
| 8 | |
| 9 | class ProfileFormType extends BaseType |
| 10 | { |
| 11 | public function buildForm(FormBuilderInterface $builder, array $options) |
| 12 | { |
| 13 | parent::buildForm($builder, $options); |
| 14 | |
| 15 | // add your custom field |
| 16 | $builder->remove('username'); // we use email as the username |
| 17 | $builder->add('name'); // first name |
| 18 | $builder->add('surname'); // last name |
| 19 | |
| 20 | //$user = $this->securityContext->getToken()->getUser(); |
| 21 | // email notifications on packages/usecases creation |
| 22 | $builder->add('emailnotif0', 'checkbox', array('label' => 'Email notifications', 'required' => false)); |
| 23 | // ...also on updates |
| 24 | $builder->add('emailnotif1', 'checkbox', array('label' => 'Also on updates', 'required' => false)); |
| 25 | } |
| 26 | |
| 27 | public function getName() |
| 28 | { |
| 29 | return 'mixstore_user_profile'; |
| 30 | } |
| 31 | } |