I have a custom form type that defines some default attr
options:
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'invalid_message' => 'The selected image does not exist',
'attr'=>array(
'data-image-picker'=>'true',
'data-label'=>'Pick Image'
),
));
}
However when i use this custom form type the entire attr
array is replaced with what is defined.
$builder->add('logo','image_picker',array(
'attr'=>array(
'data-label'=>'Logo'
),
));
When the form is rendered it only has <input data-label="Logo" ...>
How do i get it so that those options will be merged not completly overridden?
You can find these in the
options
array passed as the second argument to thebuildForm
method of your custom type. You would want to do something like this: