Full ELMS Learning Network documentation
function drupal_get_query_parameters
×
Error message
User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).cis7 common.inc | drupal_get_query_parameters(array $query = NULL, array $exclude = array('q'), $parent = '') |
cle7 common.inc | drupal_get_query_parameters(array $query = NULL, array $exclude = array('q'), $parent = '') |
elmsmedia7 common.inc | drupal_get_query_parameters(array $query = NULL, array $exclude = array('q'), $parent = '') |
icor7 common.inc | drupal_get_query_parameters(array $query = NULL, array $exclude = array('q'), $parent = '') |
meedjum_blog7 common.inc | drupal_get_query_parameters(array $query = NULL, array $exclude = array('q'), $parent = '') |
mooc7 common.inc | drupal_get_query_parameters(array $query = NULL, array $exclude = array('q'), $parent = '') |
Processes a URL query parameter array to remove unwanted elements.
Parameters
$query: (optional) An array to be processed. Defaults to $_GET.
$exclude: (optional) A list of $query array keys to remove. Use "parent[child]" to exclude nested items. Defaults to array('q').
$parent: Internal use only. Used to build the $query array key for nested items.
Return value
An array containing query parameters, which can be used for url().
Related topics
25 calls to drupal_get_query_parameters()
- aurora_pager_link in sites/
all/ themes/ ulmus/ aurora/ includes/ pager.inc - Returns HTML for a link to a specific query result page.
- date_views_querystring in sites/
all/ modules/ ulmus/ date/ date_views/ includes/ date_views.views.inc - drupal_current_script_url in includes/
install.inc - Returns the URL of the current script, with modified query parameters.
- drupal_get_destination in includes/
common.inc - Prepares a 'destination' URL query parameter for use with drupal_goto().
- drupal_redirect_form in includes/
form.inc - Redirects the user to a URL after a form has been processed.
File
- includes/
common.inc, line 417 - Common functions that many Drupal modules will need to reference.
Code
function drupal_get_query_parameters(array $query = NULL, array $exclude = array('q'), $parent = '') {
// Set defaults, if none given.
if (!isset($query)) {
$query = $_GET;
}
// If $exclude is empty, there is nothing to filter.
if (empty($exclude)) {
return $query;
}
elseif (!$parent) {
$exclude = array_flip($exclude);
}
$params = array();
foreach ($query as $key => $value) {
$string_key = ($parent ? $parent . '[' . $key . ']' : $key);
if (isset($exclude[$string_key])) {
continue;
}
if (is_array($value)) {
$params[$key] = drupal_get_query_parameters($value, $exclude, $string_key);
}
else {
$params[$key] = $value;
}
}
return $params;
}