function DatetimeFormElementTest::buildForm

Overrides FormInterface::buildForm

File

core/tests/Drupal/KernelTests/Core/Datetime/Element/DatetimeFormElementTest.php, line 61

Class

DatetimeFormElementTest
Tests static callbacks returns and form submission with datetime elements.

Namespace

Drupal\KernelTests\Core\Datetime\Element

Code

public function buildForm(array $form, FormStateInterface $form_state) : array {
    // Test datetime-local element.
    $form['datetime_local_picker'] = [
        '#type' => 'datetime',
        '#date_date_element' => 'datetime-local',
        '#date_time_element' => 'none',
    ];
    $form['submit'] = [
        '#type' => 'submit',
        '#value' => 'Submit',
    ];
    return $form;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.