function AutocompleteController::delayed_autocomplete

Same name in other branches
  1. 11.x core/modules/system/tests/modules/form_test/src/AutocompleteController.php \Drupal\form_test\AutocompleteController::delayed_autocomplete()

Returns some autocompletion content with a slight delay.

The delay is present so tests can make assertions on the "processing" layout of autocompletion.

Return value

\Symfony\Component\HttpFoundation\JsonResponse A JSON response.

1 string reference to 'AutocompleteController::delayed_autocomplete'
form_test.routing.yml in core/modules/system/tests/modules/form_test/form_test.routing.yml
core/modules/system/tests/modules/form_test/form_test.routing.yml

File

core/modules/system/tests/modules/form_test/src/AutocompleteController.php, line 21

Class

AutocompleteController
Defines a controller class with methods for autocompletion.

Namespace

Drupal\form_test

Code

public function delayed_autocomplete() {
    sleep(1);
    return new JsonResponse([
        [
            'value' => 'value',
            'label' => 'label',
        ],
    ]);
}

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