The Form component allows you to easily create, process and reuse HTML forms.
PHP
Clone or download
fabpot 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
-------

df191552b4 [Form] Added options for separate date/time labels in DateTimeType.
Latest commit d6691de Aug 2, 2018
Permalink
Failed to load latest commit information.
ChoiceList Merge branch '4.0' into 4.1 Jul 26, 2018
Command Merge branch '2.8' into 3.4 Jul 26, 2018
Console Merge branch '2.8' into 3.4 Jul 26, 2018
DependencyInjection Merge branch '3.4' into 4.0 Jul 26, 2018
Exception Merge branch '3.4' into 4.0 Jul 26, 2018
Extension feature #21002 [Form] Added options for separate date/time labels in … Aug 2, 2018
Guess Replace more docblocks by type-hints Nov 7, 2017
Resources [Validator] Remove BOM in some xlf files Jun 19, 2018
Test Merge branch '2.8' into 3.4 Jul 26, 2018
Tests Merge branch '4.1' Jul 26, 2018
Util Merge branch '2.8' into 3.4 Jul 26, 2018
.gitignore Added missing files .gitignore Jul 21, 2013
AbstractExtension.php Merge branch '2.8' into 3.4 Jul 26, 2018
AbstractRendererEngine.php Merge branch '3.4' into 4.0 Jul 26, 2018
AbstractType.php Merge branch '2.8' into 3.4 Jul 26, 2018
AbstractTypeExtension.php Removed deprecated setDefaultOptions methods Jan 20, 2015
Button.php Fixed Button::setParent() when already submitted Jan 25, 2018
ButtonBuilder.php Merge branch '3.4' into 4.0 Jul 26, 2018
ButtonTypeInterface.php [Form] Implemented support for buttons Apr 13, 2013
CHANGELOG.md added missing CHANGELOG Jun 25, 2018
CallbackTransformer.php Merge branch '2.8' into 3.4 Jul 26, 2018
ClearableErrorsInterface.php [Form] Add ability to clear form errors Jun 25, 2018
ClickableInterface.php removed dots at the end of @param and @return Jun 28, 2016
DataMapperInterface.php [CS] Apply phpdoc_annotation_without_dot Sep 11, 2017
DataTransformerInterface.php [CS] Apply phpdoc_annotation_without_dot Sep 11, 2017
Form.php Merge branch '4.1' Jul 26, 2018
FormBuilder.php Merge branch '3.4' into 4.0 Jul 26, 2018
FormBuilderInterface.php Merge branch '2.8' into 3.2 Jun 23, 2017
FormConfigBuilder.php Merge branch '3.4' into 4.0 Jul 26, 2018
FormConfigBuilderInterface.php Remove useless docblocks Oct 29, 2017
FormConfigInterface.php [Form] Fix phpdoc Sep 19, 2017
FormError.php Replace more docblocks by type-hints Nov 7, 2017
FormErrorIterator.php Merge branch '2.8' into 3.4 Jul 26, 2018
FormEvent.php [2.7] More docblock fixes Nov 7, 2017
FormEvents.php fix the constant value to be consistent with the name Oct 19, 2017
FormExtensionInterface.php [2.3][Form] Cleanup & fix phpdocs Jul 9, 2014
FormFactory.php Merge branch '2.8' into 3.4 Jul 26, 2018
FormFactoryBuilder.php Merge branch '2.8' into 3.4 Jul 26, 2018
FormFactoryBuilderInterface.php [DI] minor docblock fixes Oct 24, 2017
FormFactoryInterface.php [3.0] Clean Form, Validator, DowCrawler and some more Oct 2, 2015
FormInterface.php fixed CS May 11, 2018
FormRegistry.php Merge branch '2.8' into 3.4 Jul 26, 2018
FormRegistryInterface.php [Form] remove validation of FormRegistry::getType as FormRegistry::ha… Oct 22, 2015
FormRenderer.php Merge branch '4.1' Jul 26, 2018
FormRendererEngineInterface.php Merge branch '3.4' Nov 5, 2017
FormRendererInterface.php [Form] Add useDefaultThemes flag to the interfaces Oct 19, 2017
FormTypeExtensionInterface.php Merge branch '2.8' into 3.3 Oct 24, 2017
FormTypeGuesserChain.php Merge branch '3.4' into 4.0 Jul 26, 2018
FormTypeGuesserInterface.php DX: replace @link with @see annotation Nov 13, 2016
FormTypeInterface.php Added getBlockPrefix to FormTypeInterface Nov 28, 2015
FormView.php Merge branch '2.8' into 3.4 Jul 26, 2018
Forms.php Add scalar typehints/return types on final/internal/private code Aug 31, 2017
LICENSE fixed years in copyright Jan 3, 2018
NativeRequestHandler.php Enable the fixer enforcing fully-qualified calls for compiler-optimiz… Jul 24, 2018
PreloadedExtension.php Merge branch '2.8' into 3.4 Jul 26, 2018
README.md Updated all the README files Mar 4, 2016
RequestHandlerInterface.php [Form] Add phpdoc to `RequestHandlerInterface::isFileUpload()` method Nov 20, 2017
ResolvedFormType.php Merge branch '2.8' into 3.4 Jul 26, 2018
ResolvedFormTypeFactory.php [Form] Fixed ResolvedFormType to really be replaceable Jul 29, 2012
ResolvedFormTypeFactoryInterface.php [Form] fix and unify phpdoc Oct 31, 2013
ResolvedFormTypeInterface.php Merge branch '2.8' into 3.1 Dec 29, 2016
ReversedTransformer.php [DI] minor docblock fixes Oct 24, 2017
SubmitButton.php Fixed submitting disabled buttons Jan 25, 2018
SubmitButtonBuilder.php [Form] fix and unify phpdoc Oct 31, 2013
SubmitButtonTypeInterface.php [Form] Implemented support for buttons Apr 13, 2013
composer.json updated version to 4.2 May 7, 2018
phpunit.xml.dist fail when detecting risky tests Apr 12, 2017

README.md