Skip to content

Fixed the form types of the buttons in the Form reference #7824

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion reference/forms/types/button.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,21 @@ The ``BaseType`` class is the parent class for both the ``button`` type
and the :doc:`FormType </reference/forms/types/form>`, 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

Expand Down
15 changes: 0 additions & 15 deletions reference/forms/types/options/button_attr.rst.inc

This file was deleted.

16 changes: 15 additions & 1 deletion reference/forms/types/reset.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 15 additions & 1 deletion reference/forms/types/submit.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,21 @@ useful when :doc:`a form has multiple submit buttons </form/multiple_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

Expand Down