You are here

public function MpacAutocompleteController::autocompleteItems in Multi-path autocomplete 8

Returns response for the mpac autocompletion.

Parameters

Request $request: The current request object containing the search string.

string $type: The type of data to find (i.e. "path" or "shortcut").

Return value

JsonResponse A JSON response containing the autocomplete suggestions for existing users.

See also

MpacAutocomplete::getMatches()

1 string reference to 'MpacAutocompleteController::autocompleteItems'
mpac.routing.yml in ./mpac.routing.yml
mpac.routing.yml

File

lib/Drupal/mpac/MpacAutocompleteController.php, line 58
Contains \Drupal\mpac\MpacAutocompleteController.

Class

MpacAutocompleteController
Controller routines for mpax autocomplete routes.

Namespace

Drupal\mpac

Code

public function autocompleteItems(Request $request, $type) {
  $matches = $this->mpacAutocomplete
    ->getMatches($type, $request->query
    ->get('q'));
  return new JsonResponse($matches);
}