function views_handler_filter_in_operator::reduce_value_options
Same name in other branches
- 7.x-3.x handlers/views_handler_filter_in_operator.inc \views_handler_filter_in_operator::reduce_value_options()
When using exposed filters, we may be required to reduce the set.
2 calls to views_handler_filter_in_operator::reduce_value_options()
- views_handler_filter_in_operator::value_form in handlers/
views_handler_filter_in_operator.inc - Provide a form for setting options.
- views_handler_filter_term_node_tid::value_form in modules/
taxonomy/ views_handler_filter_term_node_tid.inc - Provide a form for setting options.
File
-
handlers/
views_handler_filter_in_operator.inc, line 236
Class
- views_handler_filter_in_operator
- Simple filter to handle matching of multiple options selectable via checkboxes
Code
function reduce_value_options($input = NULL) {
if (!isset($input)) {
$input = $this->value_options;
}
// Because options may be an array of strings, or an array of mixed arrays
// and strings (optgroups) or an array of objects, we have to
// step through and handle each one individually.
$options = array();
foreach ($input as $id => $option) {
if (is_array($option)) {
$options[$id] = $this->reduce_value_options($option);
continue;
}
else {
if (is_object($option)) {
$keys = array_keys($option->option);
$key = array_shift($keys);
if (isset($this->options['value'][$key])) {
$options[$id] = $option;
}
}
else {
if (isset($this->options['value'][$id])) {
$options[$id] = $option;
}
}
}
}
return $options;
}