1 installer_test.module | installer_test_query($query, $type, $version = 1) |
Page callback. Generates json based on the input filters.
File
- core/
modules/ installer/ tests/ installer_test/ installer_test.module, line 52
Code
function installer_test_query($query, $type, $version = 1) {
switch ($query) {
case 'query':
// Check that we have valid data
if (!isset($version)) {
print backdrop_json_encode(t('You must specify a backdrop version.'));
exit();
}
if (!isset($type)) {
print backdrop_json_encode(t('You must specify a project type.'));
exit();
}
// Get the filters
$filters = array(
'version' => $version,
'type' => $type,
'text' => (isset($_GET['text']) && $_GET['text']) ? $_GET['text'] : '',
'order_by' => isset($_GET['order_by']) ? $_GET['order_by'] : 'usage',
'sort' => isset($_GET['sort']) ? $_GET['sort'] : 'desc',
'items_per_page' => isset($_GET['items_per_page']) ? (int) $_GET['items_per_page'] : 12,
'page' => isset($_GET['page']) ? (int) $_GET['page'] : 0,
);
// Pass them off to the installer_server_get_results() function
$results = installer_test_get_results($filters);
print backdrop_json_encode($results);
exit();
}
}