Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.3k
Added documentation for buttons in forms#2489
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
2 commits Select commitHold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
129 changes: 120 additions & 9 deletionsbook/forms.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletionsreference/forms/types.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletionsreference/forms/types/button.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| .. index:: | ||
| single: Forms; Fields; button | ||
| button Field Type | ||
| ================= | ||
| .. versionadded:: 2.3 | ||
| The ``button`` type was added in Symfony 2.3 | ||
| A simple, non-responsive button. | ||
| +----------------------+----------------------------------------------------------------------+ | ||
| | Rendered as | ``button`` tag | | ||
| +----------------------+----------------------------------------------------------------------+ | ||
| | Options | - `attr`_ | | ||
| | | - `disabled`_ | | ||
| | | - `label`_ | | ||
| | | - `translation_domain`_ | | ||
| +----------------------+----------------------------------------------------------------------+ | ||
| | Parent type | none | | ||
| +----------------------+----------------------------------------------------------------------+ | ||
| | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\ButtonType` | | ||
| +----------------------+----------------------------------------------------------------------+ | ||
| Options | ||
| ------- | ||
| .. include:: /reference/forms/types/options/button_attr.rst.inc | ||
| .. include:: /reference/forms/types/options/button_disabled.rst.inc | ||
| .. include:: /reference/forms/types/options/button_label.rst.inc | ||
| .. include:: /reference/forms/types/options/button_translation_domain.rst.inc |
9 changes: 8 additions & 1 deletionreference/forms/types/map.rst.inc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletionreference/forms/types/options/attr.rst.inc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletionsreference/forms/types/options/button_attr.rst.inc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| attr | ||
| ~~~~ | ||
| **type**: array **default**: Empty 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:: | ||
| $builder->add('save', 'button', array( | ||
| 'attr' => array('class' => 'save'), | ||
| )); | ||
9 changes: 9 additions & 0 deletionsreference/forms/types/options/button_disabled.rst.inc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| disabled | ||
| ~~~~~~~~ | ||
| **type**: ``boolean`` **default**: ``false`` | ||
| If you don't want a user to be able to click a button, you can set the disabled | ||
| option to true. It will not be possible to submit the form with this button, | ||
| not even when bypassing the browser and sending a request manually, for | ||
| example with cURL. |
17 changes: 17 additions & 0 deletionsreference/forms/types/options/button_label.rst.inc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| label | ||
| ~~~~~ | ||
| **type**: ``string`` **default**: The label is "guessed" from the field name | ||
| Sets the label that will be displayed on the button. The label can also be | ||
| directly set inside the template: | ||
| .. configuration-block:: | ||
| .. code-block:: html+jinja | ||
| {{ form_widget(form.save, { 'label': 'Click me' }) }} | ||
| .. code-block:: html+php | ||
| <?php echo $view['form']->widget($form['save'], array('label' => 'Click me')) ?> |
7 changes: 7 additions & 0 deletionsreference/forms/types/options/button_translation_domain.rst.inc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| translation_domain | ||
| ~~~~~~~~~~~~~~~~~~ | ||
| **type**: ``string`` **default**: ``messages`` | ||
| This is the translation domain that will be used for any labels or options | ||
| that are rendered for this button. |
34 changes: 34 additions & 0 deletionsreference/forms/types/reset.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| .. index:: | ||
| single: Forms; Fields; reset | ||
| reset Field Type | ||
| ================ | ||
| .. versionadded:: 2.3 | ||
| The ``reset`` type was added in Symfony 2.3 | ||
| A button that resets all fields to their original values. | ||
| +----------------------+---------------------------------------------------------------------+ | ||
| | Rendered as | ``input`` ``reset`` tag | | ||
| +----------------------+---------------------------------------------------------------------+ | ||
| | Inherited | - `attr`_ | | ||
| | options | - `disabled`_ | | ||
| | | - `label`_ | | ||
| | | - `translation_domain`_ | | ||
| +----------------------+---------------------------------------------------------------------+ | ||
| | Parent type | :doc:`button</reference/forms/types/button>` | | ||
| +----------------------+---------------------------------------------------------------------+ | ||
| | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\ResetType` | | ||
| +----------------------+---------------------------------------------------------------------+ | ||
| Inherited options | ||
| ----------------- | ||
| .. include:: /reference/forms/types/options/button_attr.rst.inc | ||
| .. include:: /reference/forms/types/options/button_disabled.rst.inc | ||
| .. include:: /reference/forms/types/options/button_label.rst.inc | ||
| .. include:: /reference/forms/types/options/button_translation_domain.rst.inc |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.