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. 8.9.x core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.module \ajax_forms_test_lazy_load_form_ajax()
  3. 9 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 250
Mock module for Ajax forms testing.

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;
}