function ajax_forms_test_lazy_load_form_ajax

Same name and namespace in other branches
  1. 7.x modules/simpletest/tests/ajax_forms_test.module \ajax_forms_test_lazy_load_form_ajax()
  2. 9 core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.module \ajax_forms_test_lazy_load_form_ajax()
  3. 8.9.x core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.module \ajax_forms_test_lazy_load_form_ajax()
  4. 10 core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.module \ajax_forms_test_lazy_load_form_ajax()

AJAX form callback: Selects for the ajax_forms_test_lazy_load_form() form.

1 string reference to 'ajax_forms_test_lazy_load_form_ajax'
AjaxFormsTestLazyLoadForm::buildForm in core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestLazyLoadForm.php
Form constructor.

File

core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.module, line 239

Code

function ajax_forms_test_lazy_load_form_ajax($form, FormStateInterface $form_state) {
    $build = [
        '#markup' => 'new content',
    ];
    if ($form_state->getValue('add_files')) {
        $build['#attached']['library'][] = 'system/admin';
        $build['#attached']['library'][] = 'system/drupal.system';
        $build['#attached']['drupalSettings']['ajax_forms_test_lazy_load_form_submit'] = 'executed';
    }
    return $build;
}

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