I have a FormBuilder
with Symfony3 and I need you to add
a class
to the discount label
.
How can you observe the third parameter of the add
method is an array
and a key is attr
which has another array
with the attributes
of the input
element, but not the label.
How can I add class
to the label
?
$builder
->add('note', TextareaType::class, array(
'label' => "Notes",
'required' => false
))
->add('discount', NumberType::class, array(
'required' => false,
'attr' => array(
'class' => "hidden"
)
))
You can see the label_attr
parameter in symfony docs
'label'=>"Notes,array('label_attr' => array('class' => 'class_name'))"