10000 [Form] Added options for separate date/time labels in DateTimeType. by mktcode · Pull Request #21002 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension All 1 file type selected

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php
Original file line number Diff line number Diff line change
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