Same filename and directory in other branches
  1. 8.9.x core/modules/system/tests/modules/form_test/src/AutocompleteController.php
  2. 9 core/modules/system/tests/modules/form_test/src/AutocompleteController.php

Namespace

Drupal\form_test

File

core/modules/system/tests/modules/form_test/src/AutocompleteController.php
View source
<?php

namespace Drupal\form_test;

use Symfony\Component\HttpFoundation\JsonResponse;

/**
 * Defines a controller class with methods for autocompletion.
 */
class AutocompleteController {

  /**
   * Returns some autocompletion content with a slight delay.
   *
   * The delay is present so tests can make assertions on the "processing"
   * layout of autocompletion.
   *
   * @return \Symfony\Component\HttpFoundation\JsonResponse
   *   A JSON response.
   */
  public function delayed_autocomplete() {
    sleep(1);
    return new JsonResponse([
      [
        'value' => 'value',
        'label' => 'label',
      ],
    ]);
  }

}

Classes

Namesort descending Description
AutocompleteController Defines a controller class with methods for autocompletion.