我有这样的代码,但它不工作:如何将标签添加到表单生成器(不在树枝中)?
$builder->add('name','text',array(
'label' => 'Due Date',
));
的问题,我有fosuserbundle,我有overring形式
<?php
namespace Acme\UserBundle\Form\Type;
use Symfony\Component\Form\FormBuilder;
use FOS\UserBundle\Form\Type\RegistrationFormType as BaseType;
class RegistrationFormType extends BaseType
{
public function buildForm(FormBuilder $builder, array $options)
{
// add your custom field
$builder->add('name','text',array(
'label' => 'Due Date',
));
parent::buildForm($builder, $options);
}
public function getName()
{
return 'acme_user_registration';
}
}
,但不行,不给我任何错误并设置标签“fos_user_registration_form_name”
您的代码看起来正确。你如何验证它不起作用? – 2012-02-20 07:45:03
在fosuserbundle – 2012-02-20 08:33:15
现在编辑的问题 – 2012-02-20 08:33:45