public function SelectOtherFilter::acceptExposedInput in CCK Select Other 8
Determines if the input from a filter should change the generated query.
Parameters
array $input: The exposed data for this view.
Return value
bool TRUE if the input for this filter should be included in the view query. FALSE otherwise.
Overrides InOperator::acceptExposedInput
File
- src/
Plugin/ views/ filter/ SelectOtherFilter.php, line 140
Class
- SelectOtherFilter
- Select other filter handler.
Namespace
Drupal\cck_select_other\Plugin\views\filterCode
public function acceptExposedInput($input) {
// Take the mangled form input and morph it into the correct input that the
// parent views filter code expects.
if ($this->options['exposed']) {
$identifier = $this->options['expose']['identifier'];
$input[$identifier] = $input[$identifier . '_select_other_list'];
// Remove the other value from input and replace with the text input
// value.
if (is_array($input[$identifier])) {
if (isset($input[$identifier . '_select_other_list']) && in_array('other', $input[$identifier . '_select_other_list'])) {
unset($input[$identifier]['other']);
$input[$identifier][] = $input[$identifier . '_select_other_text_input'];
}
}
else {
if (isset($input[$identifier . '_select_other_list']) && $input[$identifier . '_select_other_list'] === 'other') {
$input[$identifier] = $input[$identifier . '_select_other_text_input'];
}
}
}
$ret = parent::acceptExposedInput($input);
return $ret;
}