From 70731bde6b60a74912ff891579278a9c5baba5bb Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 19 Apr 2017 11:47:15 +0200 Subject: [PATCH 1/2] Fixed the form types of the buttons in the Form reference --- reference/forms/types/button.rst | 16 +++++++++++++++- reference/forms/types/reset.rst | 16 +++++++++++++++- reference/forms/types/submit.rst | 16 +++++++++++++++- 3 files changed, 45 insertions(+), 3 deletions(-) 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/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 From 854c694ff3defa72982f7be767bbf9c743b81a76 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 19 Apr 2017 11:49:24 +0200 Subject: [PATCH 2/2] Deleted a now unused include file --- reference/forms/types/options/button_attr.rst.inc | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 reference/forms/types/options/button_attr.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'), - ));