| 1 | <?php |
||
| 13 | class SettingsType extends AbstractType |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * @param FormBuilderInterface $builder |
||
| 17 | * @param $options |
||
| 18 | */ |
||
| 19 | public function buildForm(FormBuilderInterface $builder, array $options) |
||
| 20 | { |
||
| 21 | $builder->add( |
||
| 22 | 'profile', |
||
| 23 | new ProfileType(), |
||
| 24 | array( |
||
| 25 | 'label' => false, |
||
| 26 | ) |
||
| 27 | ); |
||
| 28 | |||
| 29 | $builder->add('username', 'text', array( |
||
| 30 | 'label' => 'Username', |
||
| 31 | )); |
||
| 32 | $builder->add('email', 'email'); |
||
| 33 | |||
| 34 | $builder->add('submitButton', 'submit', array( |
||
| 35 | 'label' => 'Save', |
||
| 36 | 'attr' => array( |
||
| 37 | 'class' => 'btn-primary btn-lg btn-block', |
||
| 38 | ), |
||
| 39 | )); |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @param OptionsResolverInterface $resolver |
||
| 44 | */ |
||
| 45 | public function setDefaultOptions(OptionsResolverInterface $resolver) |
||
| 46 | { |
||
| 47 | $resolver->setDefaults(array( |
||
| 48 | 'data_class' => 'Application\Entity\UserEntity', |
||
| 49 | 'validation_groups' => array('settings'), |
||
| 50 | 'csrf_protection' => true, |
||
| 51 | 'csrf_field_name' => 'csrf_token', |
||
| 52 | 'cascade_validation' => true, |
||
| 53 | )); |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @return string |
||
| 58 | */ |
||
| 59 | public function getName() |
||
| 63 | } |
||
| 64 |