public function MaestroAutoCompleteController::autocompleteInteractiveHandlers in Maestro 3.x
Same name and namespace in other branches
- 8.2 src/Controller/MaestroAutoCompleteController.php \Drupal\maestro\Controller\MaestroAutoCompleteController::autocompleteInteractiveHandlers()
Returns response for the autocompletion.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The current request object containing the search string.
Return value
\Symfony\Component\HttpFoundation\JsonResponse A JSON response containing the autocomplete suggestions.
1 string reference to 'MaestroAutoCompleteController::autocompleteInteractiveHandlers'
File
- src/
Controller/ MaestroAutoCompleteController.php, line 46
Class
- MaestroAutoCompleteController
- Maestro Autocomplete controller for roles, interactive handlers and batch handlers.
Namespace
Drupal\maestro\ControllerCode
public function autocompleteInteractiveHandlers(Request $request) {
$handlers = [];
$matches = [];
$string = $request->query
->get('q');
// Let modules signal the handlers they wish to share.
$handlers = \Drupal::moduleHandler()
->invokeAll('maestro_interactive_handlers', []);
// Now what are our matches based on the incoming request.
foreach ($handlers as $name => $desc) {
if (stristr($name, $string) !== FALSE) {
$matches[] = $name;
}
}
return new JsonResponse($matches);
}