File tree Expand file tree Collapse file tree 4 files changed +45
-18
lines changed Expand file tree Collapse file tree 4 files changed +45
-18
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,21 @@ The ``BaseType`` class is the parent class for both the ``button`` type
31
31
and the :doc: `FormType </reference/forms/types/form >`, but it is not part
32
32
of the form type tree (i.e. it cannot be used as a form type on its own).
33
33
34
- .. include :: /reference/forms/types/options/button_attr.rst.inc
34
+ attr
35
+ ~~~~
36
+
37
+ **type **: ``array `` **default **: ``array() ``
38
+
39
+ If you want to add extra attributes to the HTML representation of the button,
40
+ you can use ``attr `` option. It's an associative array with HTML attribute
41
+ as a key. This can be useful when you need to set a custom class for the button::
42
+
43
+ use Symfony\Component\Form\Extension\Core\Type\ButtonType;
44
+ // ...
45
+
46
+ $builder->add('save', ButtonType::class, array(
47
+ 'attr' => array('class' => 'save'),
48
+ ));
35
49
36
50
.. include :: /reference/forms/types/options/button_disabled.rst.inc
37
51
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -26,7 +26,21 @@ A button that resets all fields to their original values.
26
26
Inherited Options
27
27
-----------------
28
28
29
- .. include :: /reference/forms/types/options/button_attr.rst.inc
29
+ attr
30
+ ~~~~
31
+
32
+ **type **: ``array `` **default **: ``array() ``
33
+
34
+ If you want to add extra attributes to the HTML representation of the button,
35
+ you can use ``attr `` option. It's an associative array with HTML attribute
36
+ as a key. This can be useful when you need to set a custom class for the button::
37
+
38
+ use Symfony\Component\Form\Extension\Core\Type\ResetType;
39
+ // ...
40
+
41
+ $builder->add('save', ResetType::class, array(
42
+ 'attr' => array('class' => 'save'),
43
+ ));
30
44
31
45
.. include :: /reference/forms/types/options/button_disabled.rst.inc
32
46
Original file line number Diff line number Diff line change @@ -37,7 +37,21 @@ useful when :doc:`a form has multiple submit buttons </form/multiple_buttons>`::
37
37
Inherited Options
38
38
-----------------
39
39
40
- .. include :: /reference/forms/types/options/button_attr.rst.inc
40
+ attr
41
+ ~~~~
42
+
43
+ **type **: ``array `` **default **: ``array() ``
44
+
45
+ If you want to add extra attributes to the HTML representation of the button,
46
+ you can use ``attr `` option. It's an associative array with HTML attribute
47
+ as a key. This can be useful when you need to set a custom class for the button::
48
+
49
+ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
50
+ // ...
51
+
52
+ $builder->add('save', SubmitType::class, array(
53
+ 'attr' => array('class' => 'save'),
54
+ ));
41
55
42
56
.. include :: /reference/forms/types/options/button_disabled.rst.inc
43
57
You can’t perform that action at this time.
0 commit comments