Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Form] Added options for separate date/time labels in DateTimeType.#21002
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
ogizanagi commentedDec 21, 2016
@mktcode : Just to mention a pending discussion on the way we'll allow to specify sub-types labels:#20887 (comment) |
xabbuh commentedDec 23, 2016
Would it make sense to make all options of the subtypes configurable (i.e. add options like |
mktcode commentedDec 24, 2016
I just handled it like the widget options ( |
ogizanagi commentedDec 24, 2016 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Configuring every sub-types options does not really make sense to me. You shouldn't care about most of them, whichare inherited or guessed within the parent type acting as encapsulation. |
fabpot commentedMar 22, 2017
What's the status of this PR? |
mktcode commentedMar 22, 2017
This PR is coherent with current handling of subtype options, so it seemed viable to me. On the other hand, in case of sub types, granting access to all of their options seems very legit too, but maybe this is a topic of its own. |
Shoplifter commentedMay 24, 2017
+1 for accessibility reasons (http://webaim.org/techniques/forms/controls#input) form rows: Personally I use this SO solution for form row atributes on a regular basis in all of my projects. |
xabbuh commentedJul 6, 2018
Thinking about this again the proposed solution looks good to me and is in line with the existing @mktcode Can you check the failure and make fabbot happy? |
mktcode commentedJul 6, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
mktcode commentedJul 31, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
fabpot commentedAug 2, 2018
Thank you@mktcode. |
…DateTimeType. (mktcode)This PR was squashed before being merged into the 4.2-dev branch (closes#21002).Discussion----------[Form] Added options for separate date/time labels in DateTimeType.If your render date and time separately you need options for each label.| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes| BC breaks? | no| Deprecations? | no| Tests pass? | yes| License | MITLet's say you have the following form field:```$builder ->add('start', DateTimeType::class, [ 'date_widget' => 'single_text', ... ]) ...```Then you can render the date and time widgets/rows/etc. separately:```<div>{{ form_row(form.start.date) }}</div><div>{{ form_row(form.start.time) }}</div>```But you can't provide labels for each, so what is displayed is just the uppercased field name ("Date" and "Time").This PR adds 'date_label' and 'time_label' options, so you can do:```$builder ->add('start', DateTimeType::class, [ 'date_widget' => 'single_text', 'date_label' => 'The Start Date', 'time_label' => 'The Start Time', ... ]) ...```Commits-------df19155 [Form] Added options for separate date/time labels in DateTimeType.
javiereguiluz commentedSep 7, 2018
@mktcode thanks! We've createdsymfony/symfony-docs#10292 to not forget about documenting this new feature. If you want to give it a try, we can help you as much as you need in the Symfony Docs repository. Thanks! |
If your render date and time separately you need options for each label.
Let's say you have the following form field:
Then you can render the date and time widgets/rows/etc. separately:
But you can't provide labels for each, so what is displayed is just the uppercased field name ("Date" and "Time").
This PR adds 'date_label' and 'time_label' options, so you can do: