diff --git a/reference/forms/types/button.rst b/reference/forms/types/button.rst index a5fa41fac8a..12b2de51737 100644 --- a/reference/forms/types/button.rst +++ b/reference/forms/types/button.rst @@ -31,7 +31,21 @@ The ``BaseType`` class is the parent class for both the ``button`` type and the :doc:`FormType `, but it is not part of the form type tree (i.e. it cannot be used as a form type on its own). -.. include:: /reference/forms/types/options/button_attr.rst.inc +attr +~~~~ + +**type**: ``array`` **default**: ``array()`` + +If you want to add extra attributes to the HTML representation of the button, +you can use ``attr`` option. It's an associative array with HTML attribute +as a key. This can be useful when you need to set a custom class for the button:: + + use Symfony\Component\Form\Extension\Core\Type\ButtonType; + // ... + + $builder->add('save', ButtonType::class, array( + 'attr' => array('class' => 'save'), + )); .. include:: /reference/forms/types/options/button_disabled.rst.inc diff --git a/reference/forms/types/options/button_attr.rst.inc b/reference/forms/types/options/button_attr.rst.inc deleted file mode 100644 index 93f70017d7e..00000000000 --- a/reference/forms/types/options/button_attr.rst.inc +++ /dev/null @@ -1,15 +0,0 @@ -attr -~~~~ - -**type**: ``array`` **default**: ``array()`` - -If you want to add extra attributes to the HTML representation of the button, -you can use ``attr`` option. It's an associative array with HTML attribute -as a key. This can be useful when you need to set a custom class for the button:: - - use Symfony\Component\Form\Extension\Core\Type\ButtonType; - // ... - - $builder->add('save', ButtonType::class, array( - 'attr' => array('class' => 'save'), - )); diff --git a/reference/forms/types/reset.rst b/reference/forms/types/reset.rst index f2ef95659cd..ef774c4c718 100644 --- a/reference/forms/types/reset.rst +++ b/reference/forms/types/reset.rst @@ -26,7 +26,21 @@ A button that resets all fields to their original values. Inherited Options ----------------- -.. include:: /reference/forms/types/options/button_attr.rst.inc +attr +~~~~ + +**type**: ``array`` **default**: ``array()`` + +If you want to add extra attributes to the HTML representation of the button, +you can use ``attr`` option. It's an associative array with HTML attribute +as a key. This can be useful when you need to set a custom class for the button:: + + use Symfony\Component\Form\Extension\Core\Type\ResetType; + // ... + + $builder->add('save', ResetType::class, array( + 'attr' => array('class' => 'save'), + )); .. include:: /reference/forms/types/options/button_disabled.rst.inc diff --git a/reference/forms/types/submit.rst b/reference/forms/types/submit.rst index fffc2ef229b..6b233e6e2d4 100644 --- a/reference/forms/types/submit.rst +++ b/reference/forms/types/submit.rst @@ -37,7 +37,21 @@ useful when :doc:`a form has multiple submit buttons `:: Inherited Options ----------------- -.. include:: /reference/forms/types/options/button_attr.rst.inc +attr +~~~~ + +**type**: ``array`` **default**: ``array()`` + +If you want to add extra attributes to the HTML representation of the button, +you can use ``attr`` option. It's an associative array with HTML attribute +as a key. This can be useful when you need to set a custom class for the button:: + + use Symfony\Component\Form\Extension\Core\Type\SubmitType; + // ... + + $builder->add('save', SubmitType::class, array( + 'attr' => array('class' => 'save'), + )); .. include:: /reference/forms/types/options/button_disabled.rst.inc