commerce_file_handler_filter_file_product_type.inc in Commerce File 7
File
views/handlers/commerce_file_handler_filter_file_product_type.inc
View source
<?php
class commerce_file_handler_filter_file_product_type extends views_handler_filter_boolean_operator {
function option_definition() {
$options = parent::option_definition();
$options['value']['default'] = TRUE;
return $options;
}
function value_form(&$form, &$form_state) {
parent::value_form($form, $form_state);
$form['value']['#title'] = t('Product is a product type with Commerce File fields');
}
function can_expose() {
return FALSE;
}
function query() {
$this
->ensure_my_table();
$field = "{$this->table_alias}.type";
$types = _commerce_file_field_info_bundles('commerce_file', 'commerce_product');
if (empty($types)) {
$types = array(
0,
);
}
$operator = empty($this->value) ? 'not in' : 'in';
$this->query
->add_where($this->options['group'], $field, $types, $operator);
}
}