public function DateTimeFormInjectionTest::buildForm in Drupal 10
Same name and namespace in other branches
- 8 core/modules/datetime/tests/src/Kernel/DateTimeFormInjectionTest.php \Drupal\Tests\datetime\Kernel\DateTimeFormInjectionTest::buildForm()
- 9 core/modules/datetime/tests/src/Kernel/DateTimeFormInjectionTest.php \Drupal\Tests\datetime\Kernel\DateTimeFormInjectionTest::buildForm()
File
- core/
modules/ datetime/ tests/ src/ Kernel/ DateTimeFormInjectionTest.php, line 66
Class
- DateTimeFormInjectionTest
- Tests serializing a form with an injected datetime instance.
Namespace
Drupal\Tests\datetime\KernelCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['datelist_element'] = [
'#title' => 'datelist test',
'#type' => 'datelist',
'#default_value' => new DrupalDateTime('2000-01-01 00:00:00'),
'#date_part_order' => [
'month',
'day',
'year',
'hour',
'minute',
'ampm',
],
'#date_text_parts' => [
'year',
],
'#date_year_range' => '2010:2020',
'#date_increment' => 15,
];
$form['#process'][] = [
$this,
'process',
];
return $form;
}