function fac_generate_json in Fast Autocomplete 7
Fast AutoComplete json callback.
1 string reference to 'fac_generate_json'
- fac_menu in ./
fac.module - Implements hook_menu().
File
- inc/
fac.json.inc, line 11 - This file contains the json callback of the Fast Autocomplete module.
Code
function fac_generate_json($language, $key) {
// Remove the .json part from the key.
$key = str_replace('.json', '', $key);
// Only continue if the requested key is shorter or equal to the configured
// key length to search for.
if (strlen($key) <= variable_get('fac_key_max_length', 5)) {
// Get the result for the key which automatically saves a json file on the
// file system.
$json_response = fac_generate_json_for_key($language, $key);
// Return the json result.
drupal_add_http_header('Content-Type', 'application/json');
echo $json_response;
}
drupal_exit();
}