You are here

function views_handler_filter_upload_fid::query in Views (for Drupal 7) 6.3

Same name and namespace in other branches
  1. 6.2 modules/upload/views_handler_filter_upload_fid.inc \views_handler_filter_upload_fid::query()

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/upload/views_handler_filter_upload_fid.inc, line 12

Class

views_handler_filter_upload_fid
Filter by whether or not a node has attached files from the upload module

Code

function query() {
  $this
    ->ensure_my_table();
  $this->query
    ->add_where($this->options['group'], "(SELECT COUNT(*) FROM {upload} u WHERE u.vid = {$this->table_alias}.{$this->real_field}) " . (empty($this->value) ? '=' : '<>') . " 0");
}