Skip to content

Commit df19155

Browse files
mktcodefabpot
authored andcommitted
[Form] Added options for separate date/time labels in DateTimeType.
1 parent d29fc2c commit df19155

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,18 @@ public function buildForm(FormBuilderInterface $builder, array $options)
142142
$dateOptions['widget'] = $options['date_widget'];
143143
}
144144

145+
if (null !== $options['date_label']) {
146+
$dateOptions['label'] = $options['date_label'];
147+
}
148+
145149
if (null !== $options['time_widget']) {
146150
$timeOptions['widget'] = $options['time_widget'];
147151
}
148152

153+
if (null !== $options['time_label']) {
154+
$timeOptions['label'] = $options['time_label'];
155+
}
156+
149157
if (null !== $options['date_format']) {
150158
$dateOptions['format'] = $options['date_format'];
151159
}
@@ -238,6 +246,8 @@ public function configureOptions(OptionsResolver $resolver)
238246
// this option.
239247
'data_class' => null,
240248
'compound' => $compound,
249+
'date_label' => null,
250+
'time_label' => null,
241251
));
242252

243253
// Don't add some defaults in order to preserve the defaults

0 commit comments

Comments
 (0)