You are here

function date_views_filter_handler_simple::get_filter_value in Date 8

Same name and namespace in other branches
  1. 7.3 date_views/includes/date_views_filter_handler_simple.inc \date_views_filter_handler_simple::get_filter_value()
  2. 7.2 date_views/includes/date_views_filter_handler_simple.inc \date_views_filter_handler_simple::get_filter_value()

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.

3 calls to date_views_filter_handler_simple::get_filter_value()
date_views_filter_handler_simple::accept_exposed_input in date_views/includes/date_views_filter_handler_simple.inc
date_views_filter_handler_simple::op_between in date_views/includes/date_views_filter_handler_simple.inc
date_views_filter_handler_simple::op_simple in date_views/includes/date_views_filter_handler_simple.inc

File

date_views/includes/date_views_filter_handler_simple.inc, line 88
A standard Views filter for a single date field, using Date API form selectors and sql handling.

Class

date_views_filter_handler_simple

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);
}