简体   繁体   中英

Symfony2 form, how options is set?

Ok, let me straight.

I know how to use setDefaultOptions and set new default custom options and its value in FormType like that:

public function setDefaultOptions(OptionsResolverInterface $resolver) {
    $resolver->setDefaults(array('custom' => 'custom value'));
}

But, I want to know how the other default options are set and finally available in

public function buildForm(FormBuilderInterface $builder, array $options) {
}

I tried to trace it from $this->createForm in symfony2 controller, but then I stuck in the FormFactory::createNamedBuilder function of symfony2:

public function createNamedBuilder($name, $type = 'form', $data = null, array $options = array())

Any hint/answer is appreciated, thanks!

Here are all availaable options for any form type : http://symfony.com/doc/current/reference/forms/types/form.html

Additionnaly, you can find in documentation the specific options for each form type provided by symfony. For example, text form : http://symfony.com/doc/current/reference/forms/types/text.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM