我有一个课程类型:
class CandidatType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('prenom', TextType::class)
->add('nom', TextType::class)
->add('email', EmailType::class)
->add('telephone', TelType::class)
...
我想在Twig中仅显示属性email
那怎么做呢?
在树枝上,我这样做了:
{{ form_start(form) }}
<div class="">
{{ form_errors(form) }}
</div>
<div class="row">
<div class="col">
{{ form_row(form.email) }}
</div>
</div>
{{ form_end(form) }}
但是它显示了所有形式:/我只需要email