[英]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: 我知道如何使用setDefaultOptions
并像这样在FormType
设置新的默认自定义选项及其值:
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: 我试图从symfony2控制器中的$this->createForm
跟踪它,但是随后我陷入了FormFactory::createNamedBuilder
的FormFactory::createNamedBuilder
函数中:
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 这是任何表单类型的所有可用选项: 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. 此外,您可以在文档中找到symfony提供的每种表单类型的特定选项。 For example, text form : http://symfony.com/doc/current/reference/forms/types/text.html 例如,文本格式: http : //symfony.com/doc/current/reference/forms/types/text.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.