From df191552b49601e27a147e3ec93ff9298394e9a1 Mon Sep 17 00:00:00 2001 From: Markus Date: Tue, 20 Dec 2016 19:27:28 +0100 Subject: [PATCH] [Form] Added options for separate date/time labels in DateTimeType. --- .../Form/Extension/Core/Type/DateTimeType.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php b/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php index c538c09a0073..5bb70a39ec9f 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php @@ -142,10 +142,18 @@ public function buildForm(FormBuilderInterface $builder, array $options) $dateOptions['widget'] = $options['date_widget']; } + if (null !== $options['date_label']) { + $dateOptions['label'] = $options['date_label']; + } + if (null !== $options['time_widget']) { $timeOptions['widget'] = $options['time_widget']; } + if (null !== $options['time_label']) { + $timeOptions['label'] = $options['time_label']; + } + if (null !== $options['date_format']) { $dateOptions['format'] = $options['date_format']; } @@ -238,6 +246,8 @@ public function configureOptions(OptionsResolver $resolver) // this option. 'data_class' => null, 'compound' => $compound, + 'date_label' => null, + 'time_label' => null, )); // Don't add some defaults in order to preserve the defaults