You are here

function commerce_product_reference_handler_filter_node_is_product_display::query in Commerce Core 7

Add this filter to the query.

Due to the nature of fapi, the value and the operator have an unintended level of indirection. You will find them in $this->operator and $this->value respectively.

Overrides views_handler_filter_boolean_operator::query

File

modules/product_reference/includes/views/handlers/commerce_product_reference_handler_filter_node_is_product_display.inc, line 11

Class

commerce_product_reference_handler_filter_node_is_product_display
Filter by whether or not a node is a product display.

Code

function query() {
  $this
    ->ensure_my_table();
  $node_types = array_keys(commerce_product_reference_node_types());
  if (!$node_types) {

    // instead of:
    // WHERE (( (node.type NOT IN  ()) ))
    // do this:
    // WHERE (( (node.type NOT IN  ('')) ))
    $node_types = array(
      '',
    );
  }
  $this->query
    ->add_where($this->options['group'], "{$this->table_alias}.{$this->real_field}", $node_types, $this->value ? 'IN' : 'NOT IN');
}