1 date.views.inc date_views_querystring($view, $extra_params = array())

Helper function to generate a query string.


object $view: A View object.

array $extra_params: An extra parameters.

Return value

null/string: Return a query or NULL.


core/modules/date/views/date.views.inc, line 159
Defines date-related Views data and plugins:


function date_views_querystring($view, $extra_params = array()) {
  $query_params = array_merge($_GET, $extra_params);
  // Allow NULL params to be removed from the query string.
  foreach ($extra_params as $key => $value) {
    if (!isset($value)) {
  // Filter the special "q" and "view" variables out of the query string.
  $exclude = array('q');
  // If we don't explicitly add a value for "view", filter it out.
  if (empty($extra_params['view'])) {
    $exclude[] = 'view';

  $query = backdrop_get_query_parameters($query_params, $exclude);
  // To prevent an empty query string from adding a "?" on to the end of a URL,
  // we return NULL.
  return !empty($query) ? $query : NULL;