function views_handler_filter_numeric::accept_exposed_input

Do some minor translation of the exposed input.

Overrides views_handler_filter::accept_exposed_input

1 call to views_handler_filter_numeric::accept_exposed_input()
views_handler_filter_date::accept_exposed_input in handlers/views_handler_filter_date.inc
Do some minor translation of the exposed input.
1 method overrides views_handler_filter_numeric::accept_exposed_input()
views_handler_filter_date::accept_exposed_input in handlers/views_handler_filter_date.inc
Do some minor translation of the exposed input.

File

handlers/views_handler_filter_numeric.inc, line 368

Class

views_handler_filter_numeric
Simple filter to handle greater than/less than filters.

Code

public function accept_exposed_input($input) {
    if (empty($this->options['exposed'])) {
        return TRUE;
    }
    // Rewrite the input value so that it's in the correct format so that the
    // parent gets the right data.
    if (!empty($this->options['expose']['identifier'])) {
        $value =& $input[$this->options['expose']['identifier']];
        if (!is_array($value)) {
            $value = array(
                'value' => $value,
            );
        }
        if (!empty($this->options['expose']['use_operator']) && !empty($this->options['expose']['operator_id']) && isset($input[$this->options['expose']['operator_id']])) {
            if ($input[$this->options['expose']['operator_id']] === 'empty' || $input[$this->options['expose']['operator_id']] === 'not empty') {
                // Parent method will expect a boolean value. We don't ask for a value
                // so we'll force "Yes".
                $value['value'] = 1;
            }
        }
    }
    $rc = parent::accept_exposed_input($input);
    if (empty($this->options['expose']['required'])) {
        // We have to do some of our own checking for non-required filters.
        $info = $this->operators();
        if (!empty($info[$this->operator]['values']) && is_array($value)) {
            switch ($info[$this->operator]['values']) {
                case 1:
                    if (array_key_exists('value', $value) && $value['value'] === '') {
                        return FALSE;
                    }
                    break;
                case 2:
                    if (array_key_exists('min', $value) && $value['min'] === '' && array_key_exists('max', $value) && $value['max'] === '') {
                        return FALSE;
                    }
                    break;
            }
        }
    }
    return $rc;
}