-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Add help option to FormType #9361
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
Conversation
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.
Looks like a great feature & very complete doc PR! I've added some small comments, would be awesome if you can manage to fix them.
|
||
**type**: ``string`` **default**: null | ||
|
||
Allows you to define a help text below the form field. |
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.
What about something like: "Allows you to define extra information about the field, which will be rendered below the form field by default." (as you're allowed to change the layout of a form in every way you want)
|
||
$builder->add('name', null, array( | ||
'help' => 'My helper message.', | ||
)); |
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.
Please indent the array entry with 4 spaces and you have to add .. code-block:: php
before this code example in order to render it as PHP code.
reference/twig_reference.rst
Outdated
``view`` | ||
**type**: ``FormView`` | ||
|
||
Renders the text help for the given field. |
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.
"Renders the text help" -> "Renders the help text" ?
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.
I've fixed it too, but apparently, don't recognized.
This PR was merged into the 4.1-dev branch. Discussion ---------- Add a data_help method in Form | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #26331 | License | MIT | Doc PR | symfony/symfony-docs#9361 Add a form_help method in twig to display a help message in form. A `help` keyword is added to all FormType to define the message. Commits ------- 585ca28b8a Add return type hint 859ee03785 Revert: remove comment line from twig templates d723756331 Fix some mistakes c74e0dc2da Use spaceless balises in Twig templates 8b937ff43f Try without try/catch 32bf1f68ad Test the renderHelp method in all Tests about help to skip them if necessary. 437b77e81a Skip renderHelp test as skipped if not override d84be700b2 Update composer files 075fcfd07c [FrameworkBundle] Add widgetAtt to formTable/form_row f1d13a860c Fix Fabpot.io 69ded67643 Added form_help on horizontal design and removed special variable fd53bc579a Enable aria-described in row for all Templates 98065d38b5 fabpot.io fix edb95f8e44 Use array long syntax aada72c5d4 Set help option on nul as default f948147e38 Rename help id (snake_case) 77fa3178bd Fix Test 30deaa9b28 PSR fix bf4d08c5ae Add aria-describedBy on input 1f3a15e33b Rename id 058489d7df Add an id to the help 6ea7a2054b Remove vars option from form_help ba798dfdf4 FrameworkBundle Tests 4f2581d7da Use array long syntax f15bc79df1 Fix coding standards c934e496d2 Add test without help set 8094804522 Add Tests 067c681580 Template for table, Foundation and Bootstrap 3 d3e3e492df Fix: check translation domain 2c2c04549f Adapt existant tests 831693ad45 Add trans filter e311838aed Remove raw filter for help 8b97c1b516 Use a shortcut to acces help var in Twig template 1b89f9d9dd Add a template fot div_layout c8914f591e Add a data_help method in Form
This PR was merged into the 4.1-dev branch. Discussion ---------- Add a data_help method in Form | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #26331 | License | MIT | Doc PR | symfony/symfony-docs#9361 Add a form_help method in twig to display a help message in form. A `help` keyword is added to all FormType to define the message. Commits ------- 585ca28b8a Add return type hint 859ee03785 Revert: remove comment line from twig templates d723756331 Fix some mistakes c74e0dc2da Use spaceless balises in Twig templates 8b937ff43f Try without try/catch 32bf1f68ad Test the renderHelp method in all Tests about help to skip them if necessary. 437b77e81a Skip renderHelp test as skipped if not override d84be700b2 Update composer files 075fcfd07c [FrameworkBundle] Add widgetAtt to formTable/form_row f1d13a860c Fix Fabpot.io 69ded67643 Added form_help on horizontal design and removed special variable fd53bc579a Enable aria-described in row for all Templates 98065d38b5 fabpot.io fix edb95f8e44 Use array long syntax aada72c5d4 Set help option on nul as default f948147e38 Rename help id (snake_case) 77fa3178bd Fix Test 30deaa9b28 PSR fix bf4d08c5ae Add aria-describedBy on input 1f3a15e33b Rename id 058489d7df Add an id to the help 6ea7a2054b Remove vars option from form_help ba798dfdf4 FrameworkBundle Tests 4f2581d7da Use array long syntax f15bc79df1 Fix coding standards c934e496d2 Add test without help set 8094804522 Add Tests 067c681580 Template for table, Foundation and Bootstrap 3 d3e3e492df Fix: check translation domain 2c2c04549f Adapt existant tests 831693ad45 Add trans filter e311838aed Remove raw filter for help 8b97c1b516 Use a shortcut to acces help var in Twig template 1b89f9d9dd Add a template fot div_layout c8914f591e Add a data_help method in Form
This PR was merged into the 4.1-dev branch. Discussion ---------- Add a data_help method in Form | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #26331 | License | MIT | Doc PR | symfony/symfony-docs#9361 Add a form_help method in twig to display a help message in form. A `help` keyword is added to all FormType to define the message. Commits ------- 585ca28 Add return type hint 859ee03 Revert: remove comment line from twig templates d723756 Fix some mistakes c74e0dc Use spaceless balises in Twig templates 8b937ff Try without try/catch 32bf1f6 Test the renderHelp method in all Tests about help to skip them if necessary. 437b77e Skip renderHelp test as skipped if not override d84be70 Update composer files 075fcfd [FrameworkBundle] Add widgetAtt to formTable/form_row f1d13a8 Fix Fabpot.io 69ded67 Added form_help on horizontal design and removed special variable fd53bc5 Enable aria-described in row for all Templates 98065d3 fabpot.io fix edb95f8 Use array long syntax aada72c Set help option on nul as default f948147 Rename help id (snake_case) 77fa317 Fix Test 30deaa9 PSR fix bf4d08c Add aria-describedBy on input 1f3a15e Rename id 058489d Add an id to the help 6ea7a20 Remove vars option from form_help ba798df FrameworkBundle Tests 4f2581d Use array long syntax f15bc79 Fix coding standards c934e49 Add test without help set 8094804 Add Tests 067c681 Template for table, Foundation and Bootstrap 3 d3e3e49 Fix: check translation domain 2c2c045 Adapt existant tests 831693a Add trans filter e311838 Remove raw filter for help 8b97c1b Use a shortcut to acces help var in Twig template 1b89f9d Add a template fot div_layout c8914f5 Add a data_help method in Form
status: need review, code merged |
reference/forms/types/birthday.rst
Outdated
@@ -42,6 +42,7 @@ option defaults to 120 years ago to the current year. | |||
| | - `invalid_message`_ | | |||
| | - `invalid_message_parameters`_ | | |||
| | - `mapped`_ | | |||
| | - `help`_ | |
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.
should be between disabled
and invalid_message
IMO to keep options in alphabetical order
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.
same in the other files
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.
Looks good to me, except for the comment by @xabbuh about alphabetical ordering. Thanks for the contribution, I was looking for this exact documentation just the other day.
I'll change the order :-) |
This PR was squashed before being merged into the 4.1 branch (closes #9361). Discussion ---------- Add help option to FormType Add documentation about the new feature symfony/symfony#26332 Commits ------- 5bdf708 Add help option to FormType
@mpiot thanks for providing these docs and congrats on your first Symfony Docs contribution. Also, thanks for contributing this great feature to Symfony forms. |
Add documentation about the new feature symfony/symfony#26332