function Callbacks::validationFormCallback

Same name and namespace in other branches
  1. 11.x core/modules/system/tests/modules/ajax_forms_test/src/Callbacks.php \Drupal\ajax_forms_test\Callbacks::validationFormCallback()

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

File

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

Class

Callbacks
Simple object for testing methods as Ajax callbacks.

Namespace

Drupal\ajax_forms_test

Code

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

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