我設法覆蓋模板和註冊頁面的表單,但我注意到的一件事是最初的字段被注入。FOSUserBundle,SonataUserBundle覆蓋註冊
這是我buildform代碼:
public function buildForm(FormBuilderInterface $builder, array $options) {
$builder->add('firstname', 'text', array('label' => 'First Name'))
->add('lastname', 'text', array('label' => 'Last Name'))
->add('over_18', 'checkbox', array('label' => 'Yes I am over 18', 'mapped' => false))
->add('email', 'text', array('label' => 'Email'))
->add('phone', 'text', array('label' => 'What is your telephone number?'))
->add('password', 'password', array('label' => 'Choose a password'))
;
}
當我在模板做{{ dump(form) }}
我得到這個:
我知道我可以做$ builder->刪除()在這些領域,但如果我覆蓋表單我應該真的需要這樣做嗎?
謝謝