function Callbacks::validationNumberFormCallback

Ajax form callback: Selects the 'driver_number' element of the validation form.

File

core/modules/system/tests/modules/ajax_forms_test/src/Callbacks.php, line 293

Class

Callbacks
Simple object for testing methods as Ajax callbacks.

Namespace

Drupal\ajax_forms_test

Code

public static function validationNumberFormCallback($form, FormStateInterface $form_state) : array {
    \Drupal::messenger()->addStatus("ajax_forms_test_validation_number_form_callback invoked");
    \Drupal::messenger()->addStatus(t("Callback: driver_number=%driver_number, spare_required_field=%spare_required_field", [
        '%driver_number' => $form_state->getValue('driver_number'),
        '%spare_required_field' => $form_state->getValue('spare_required_field'),
    ]));
    return [
        '#markup' => '<div id="message_area_number">ajax_forms_test_validation_number_form_callback at ' . date('c') . '</div>',
    ];
}

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