function search_api_autocomplete_test_custom_autocomplete_callback in Search API Autocomplete 8
Outputs some autocomplete suggestions as JSON, for testing purposes.
1 call to search_api_autocomplete_test_custom_autocomplete_callback()
- custom_autocomplete_script.php in tests/
search_api_autocomplete_test/ core/ custom_autocomplete_script.php
File
- tests/
search_api_autocomplete_test/ core/ custom_autocomplete_script.php, line 23
Code
function search_api_autocomplete_test_custom_autocomplete_callback() {
$suggestions = [];
foreach ($_GET as $key => $value) {
$suggestions[] = [
'value' => $value,
'label' => htmlentities("{$key}: {$value}"),
];
}
header('Content-type: application/json');
echo json_encode($suggestions, JSON_PRETTY_PRINT);
exit;
}