How do I simply add a css class or inline style to a button like this? Is there something you can put in that array() where I got label?
private function createDeleteForm($id)
{
return $this->createFormBuilder()
->setAction($this->generateUrl('video_delete', array('id' => $id)))
->setMethod('DELETE')
->add('submit', 'submit', array('label' => 'Radera denna video'))
->getForm()
;
}
I tried the aged old trick of looking at the elements id to see if I could sort of hack it by putting #ItsId in my css file, but no it doesn't have an id. It renders like this:
<form method="post" action="/site/web/app_dev.php/Media/video/1/delete">
<input type="hidden" name="_method" value="DELETE">
<div id="form">
<div>
<button type="submit" id="form_submit" name="form[submit]">
Radera denna video
</button>
</div>
<input type="hidden" id="form__token" name="form[_token]" value="2c2889b6744aade419618485e1b3ce0c9c341a42">
</div>
</form>
->add('submit', 'submit', array(
'label' => 'Radera denna video',
'attr' => array('class' => 'class-you-wish-to-add')
));
This is a duplicate of: How to set a class attribute to a Symfony2 form input
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments