function AjaxTestFormPromise::executeCommands

Same name and namespace in other branches
  1. 9 core/modules/system/tests/modules/ajax_test/src/Form/AjaxTestFormPromise.php \Drupal\ajax_test\Form\AjaxTestFormPromise::executeCommands()
  2. 10 core/modules/system/tests/modules/ajax_test/src/Form/AjaxTestFormPromise.php \Drupal\ajax_test\Form\AjaxTestFormPromise::executeCommands()

Ajax callback for the "Execute commands button" button.

File

core/modules/system/tests/modules/ajax_test/src/Form/AjaxTestFormPromise.php, line 53

Class

AjaxTestFormPromise
Test form for ajax_test_form_promise.

Namespace

Drupal\ajax_test\Form

Code

public static function executeCommands(array $form, FormStateInterface $form_state) {
    $selector = '#ajax_test_form_promise_wrapper';
    $response = new AjaxResponse();
    $response->addCommand(new AppendCommand($selector, '1'));
    $response->addCommand(new AjaxTestCommandReturnPromise($selector, '2'));
    $response->addCommand(new AppendCommand($selector, '3'));
    $response->addCommand(new AppendCommand($selector, '4'));
    $response->addCommand(new AjaxTestCommandReturnPromise($selector, '5'));
    return $response;
}

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