function InOperator::reduce_value_options in Views (for Drupal 7) 8.3
When using exposed filters, we may be required to reduce the set.
2 calls to InOperator::reduce_value_options()
- InOperator::value_form in lib/
Drupal/ views/ Plugin/ views/ filter/ InOperator.php - Options form subform for setting options.
- TaxonomyIndexTid::value_form in lib/
Views/ taxonomy/ Plugin/ views/ filter/ TaxonomyIndexTid.php - Options form subform for setting options.
File
- lib/
Drupal/ views/ Plugin/ views/ filter/ InOperator.php, line 251 - Definition of Drupal\views\Plugin\views\filter\InOperator.
Class
- InOperator
- Simple filter to handle matching of multiple options selectable via checkboxes
Namespace
Drupal\views\Plugin\views\filterCode
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;
}
elseif (is_object($option)) {
$keys = array_keys($option->option);
$key = array_shift($keys);
if (isset($this->options['value'][$key])) {
$options[$id] = $option;
}
}
elseif (isset($this->options['value'][$id])) {
$options[$id] = $option;
}
}
return $options;
}