function AjaxTestFormPromise::buildForm
Same name in other branches
- 9 core/modules/system/tests/modules/ajax_test/src/Form/AjaxTestFormPromise.php \Drupal\ajax_test\Form\AjaxTestFormPromise::buildForm()
- 11.x core/modules/system/tests/modules/ajax_test/src/Form/AjaxTestFormPromise.php \Drupal\ajax_test\Form\AjaxTestFormPromise::buildForm()
Form for testing the addition of various types of elements via Ajax.
Overrides FormInterface::buildForm
File
-
core/
modules/ system/ tests/ modules/ ajax_test/ src/ Form/ AjaxTestFormPromise.php, line 28
Class
- AjaxTestFormPromise
- Test form for ajax_test_form_promise.
Namespace
Drupal\ajax_test\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['#attached']['library'][] = 'ajax_test/command_promise';
$form['custom']['#prefix'] = '<div id="ajax_test_form_promise_wrapper">';
$form['custom']['#suffix'] = '</div>';
// Button to test for the execution order of Ajax commands.
$form['test_execution_order_button'] = [
'#type' => 'submit',
'#value' => $this->t('Execute commands button'),
'#button_type' => 'primary',
'#ajax' => [
'callback' => [
static::class,
'executeCommands',
],
'progress' => [
'type' => 'throbber',
'message' => NULL,
],
'wrapper' => 'ajax_test_form_promise_wrapper',
],
];
return $form;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.