-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
issue-13589: adjust docs for custom-false-values for checkbox type #9031
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
issue-13589: adjust docs for custom-false-values for checkbox type #9031
Conversation
…oString transformer (leberknecht) This PR was squashed before being merged into the 4.1-dev branch (closes #25741). Discussion ---------- [Form] issue-13589: adding custom false-values to BooleanToString transformer | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #13589 | License | MIT | Doc PR | symfony/symfony-docs#9031 As suggested in #13589 , this PR adds the option to specify custom false-values, so we can use the CheckBoxType to handle strings '1' / '0' and eval them to true / false. While HTTP defines that checkbox types are either submitted=true or not-submitted=false, no matter of what value was submitted, it would be nice to have this option. Also refs (which read like "the basic idea of the feature was accepted, PR almost done, then something-happend so PR wasnt merged"..?) symfony/symfony#15054 symfony/symfony#18005 Commits ------- a3e5ac496f [Form] issue-13589: adding custom false-values to BooleanToString transformer
…oString transformer (leberknecht) This PR was squashed before being merged into the 4.1-dev branch (closes #25741). Discussion ---------- [Form] issue-13589: adding custom false-values to BooleanToString transformer | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #13589 | License | MIT | Doc PR | symfony/symfony-docs#9031 As suggested in #13589 , this PR adds the option to specify custom false-values, so we can use the CheckBoxType to handle strings '1' / '0' and eval them to true / false. While HTTP defines that checkbox types are either submitted=true or not-submitted=false, no matter of what value was submitted, it would be nice to have this option. Also refs (which read like "the basic idea of the feature was accepted, PR almost done, then something-happend so PR wasnt merged"..?) #15054 #18005 Commits ------- a3e5ac4 [Form] issue-13589: adding custom false-values to BooleanToString transformer
@vudaltsov we'd need your review about this proposal related to forms. Thanks a lot! |
@javiereguiluz , thanx for pinging me on this :) I agree with the contents of this PR, but I would also dedicate a paragraph to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a section under Field Options
.
reference/forms/types/checkbox.rst
Outdated
|
||
+-------------+------------------------------------------------------------------------+ | ||
| Rendered as | ``input`` ``checkbox`` field | | ||
+-------------+------------------------------------------------------------------------+ | ||
| Options | - `value`_ | | ||
| | - `false_values`_ | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the description of this option seems to be missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doh! Indeed, sorry. Added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh and maybe we should sort the options alphabetically (i.e. put false-values
before value
). This must then also be taken into account below then.
@@ -0,0 +1,6 @@ | |||
false_values | |||
~~~~~ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line must contain as many ~
characters as the length of the headline
|
||
**type**: ``array`` **default**: ``array(null)`` | ||
|
||
An array of values to be interpreted as `false`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to backticks here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ops, two (not to) :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"doh!" again :D fixed
@leberknecht thanks for this contribution! Sadly I couldn't merge it with the proprietary tool we use to merge pull requests in Symfony repos. I tried to solve it but I couldn't (for some unknown reasons, the conflict was huge with tens of conflicting files). So, I ended up replicating your changes in this other pull request: #9812. I'm really sorry but I wanted to assure you that I tried to maintain your commits and pull request but I couldn't. I'm sorry. |
:D No worries! |
refs #13589 on symfony/symfony repo