Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #21002 [Form] Added options for separate date/time labels in …
…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 | MIT Let'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.
- Loading branch information