public function availability_calendar_handler_filter_availability::accept_exposed_input in Availability Calendars 7.4
Same name and namespace in other branches
- 7.5 views/availability_calendar_handler_filter_availability.inc \availability_calendar_handler_filter_availability::accept_exposed_input()
- 7.3 availability_calendar_handler_filter_availability.inc \availability_calendar_handler_filter_availability::accept_exposed_input()
Check to see if input from the exposed filters should change the behavior of this filter.
Overrides views_handler_filter::accept_exposed_input
File
- views/
availability_calendar_handler_filter_availability.inc, line 346
Class
- availability_calendar_handler_filter_availability
- Views handler to filter on availability.
Code
public function accept_exposed_input($input) {
if (empty($this->options['exposed'])) {
return TRUE;
}
if (!empty($this->options['expose']['use_operator']) && !empty($this->options['expose']['operator_id']) && isset($input[$this->options['expose']['operator_id']])) {
// Fetch operator from form (instead of from $this object)
$this->operator = $input[$this->options['expose']['operator_id']];
}
if (!empty($this->options['expose']['identifier'])) {
// Fetch value from form (instead of from $this object)
$this->value = $input[$this->options['expose']['identifier']];
// Check if the values are filled in, if not, we don't want to change the
// query. A value is filled in if it is not empty and does not equal an
// invalid default value. Validation will already have failed if the value
// does not equal the default value but is invalid. So we just check if
// the values are valid.
$operators = $this
->operators();
$values = $operators[$this->operator]['values'];
foreach ($values as $value_name) {
if (empty($this->value[$value_name])) {
return FALSE;
}
else {
if ($value_name === 'duration') {
if (!is_int($this->value[$value_name]) && !ctype_digit($this->value[$value_name]) || $this->value[$value_name] <= 0) {
return FALSE;
}
}
else {
if (availability_calendar_parse_entry_date($this->value[$value_name]) === FALSE) {
return FALSE;
}
}
}
}
}
return TRUE;
}