I use the formbuilder in a Symfony project.
I’d like to use as much as I can the {{ form_row(form) }} in my twig template to avoid writing errors, label, help and widget myself.
In this particular case, I’d like to add a link in the form_help. Is it possible to do it from the form builder?
Advertisement
Answer
yes it’s possible to use HTML directly in the 'help' option of the formBuilder like this:
class TotoType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name', TextType::class, [
'help' => 'go tho the <a href="prenom.com">list</a> name'
])
;
}
}