You are here

function commerce_file_handler_filter_file_product_type::query in Commerce File 7

Query against the line item's type column using an IN() condition.

Overrides views_handler_filter_boolean_operator::query

File

views/handlers/commerce_file_handler_filter_file_product_type.inc, line 34

Class

commerce_file_handler_filter_file_product_type
Filter line items by whether or not they are of a product line item type.

Code

function query() {
  $this
    ->ensure_my_table();
  $field = "{$this->table_alias}.type";
  $types = _commerce_file_field_info_bundles('commerce_file', 'commerce_product');

  // add a default to invalidate
  if (empty($types)) {
    $types = array(
      0,
    );
  }
  $operator = empty($this->value) ? 'not in' : 'in';
  $this->query
    ->add_where($this->options['group'], $field, $types, $operator);
}