You are here

function views_handler_filter_in_operator::op_simple in Views (for Drupal 7) 6.3

Same name and namespace in other branches
  1. 6.2 handlers/views_handler_filter_in_operator.inc \views_handler_filter_in_operator::op_simple()
  2. 7.3 handlers/views_handler_filter_in_operator.inc \views_handler_filter_in_operator::op_simple()

File

handlers/views_handler_filter_in_operator.inc, line 362

Class

views_handler_filter_in_operator
Simple filter to handle matching of multiple options selectable via checkboxes

Code

function op_simple() {
  if (empty($this->value)) {
    return;
  }
  $this
    ->ensure_my_table();
  $placeholder = !empty($this->definition['numeric']) ? '%d' : "'%s'";
  $replace = array_fill(0, sizeof($this->value), $placeholder);
  $in = ' (' . implode(", ", $replace) . ')';

  // We use array_values() because the checkboxes keep keys and that can cause
  // array addition problems.
  $this->query
    ->add_where($this->options['group'], "{$this->table_alias}.{$this->real_field} " . $this->operator . $in, array_values($this->value));
}