You are here

public function Callbacks::imageButtonCallback in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/ajax_forms_test/src/Callbacks.php \Drupal\ajax_forms_test\Callbacks::imageButtonCallback()
  2. 9 core/modules/system/tests/modules/ajax_forms_test/src/Callbacks.php \Drupal\ajax_forms_test\Callbacks::imageButtonCallback()

Ajax callback to confirm image button was submitted.

File

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

Class

Callbacks
Simple object for testing methods as Ajax callbacks.

Namespace

Drupal\ajax_forms_test

Code

public function imageButtonCallback($form, FormStateInterface $form_state) {
  $response = new AjaxResponse();
  $response
    ->addCommand(new HtmlCommand('#ajax_image_button_result', "<div id='ajax-1-more-div'>Something witty!</div>"));
  return $response;
}