Skip to content

Commit

Permalink
[Form] Added options for separate date/time labels in DateTimeType.
Browse files Browse the repository at this point in the history
  • Loading branch information
mktcode authored and fabpot committed Aug 2, 2018
1 parent d29fc2c commit df19155
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php
Expand Up @@ -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'];
}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit df19155

Please sign in to comment.