1 date_views_filter_handler_simple.inc date_views_filter_handler_simple::get_filter_value($prefix, $input)

Helper function to see if we need to swap in the default value.

Views exposed filters treat everything as submitted, so if it's an empty value we have to see if anything actually was submitted. If nothing has really been submitted, we need to swap in our default value logic.

File

core/modules/date/views/date_views_filter_handler_simple.inc, line 109
A standard Views filter for a single date field, using Date API form selectors and sql handling.

Class

date_views_filter_handler_simple
@file A standard Views filter for a single date field, using Date API form selectors and sql handling.

Code

function get_filter_value($prefix, $input) {
  // All our date widgets provide datetime values but we use ISO in our SQL
  // for consistency between the way filters and arguments work (arguments
  // cannot contain spaces).
  if (empty($input)) {
    if (empty($this->options['exposed'])) {
      return str_replace(' ', 'T', $this->date_default_value($prefix));
    }
    elseif (isset($this->options['expose']['identifier']) && !isset($_GET[$this->options['expose']['identifier']])) {
      return str_replace(' ', 'T', $this->date_default_value($prefix));
    }
  }

  return str_replace(' ', 'T', $input);
}