You are here

function workflow_views_handler_filter_sid::query in Workflow 7

Same name and namespace in other branches
  1. 6.2 workflow_views/includes/workflow_views_handler_filter_sid.inc \workflow_views_handler_filter_sid::query()
  2. 6 workflow_views/includes/workflow_views_handler_filter_sid.inc \workflow_views_handler_filter_sid::query()
  3. 7.2 workflow_views/handlers/workflow_views_handler_filter_sid.inc \workflow_views_handler_filter_sid::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_in_operator::query

File

workflow_views/includes/workflow_views_handler_filter_sid.inc, line 32
Provide views filter handler for workflow.module.

Class

workflow_views_handler_filter_sid
Filter by state.

Code

function query() {
  $value = $this
    ->is_a_group() && !$this->options['expose']['multiple'] ? drupal_array_merge_deep_array($this->value) : $this->value;
  if (empty($value)) {
    return;
  }
  $this
    ->ensure_my_table();
  $placeholder = !empty($this->definition['numeric']) ? '%d' : "'%s'";
  if (count($value) == 1) {
    $this->operator = $this->operator == 'in' ? '= ' : '!= ';
    $in = !empty($this->definition['numeric']) ? '%d' : "'%s'";
  }
  if ($this->operator == 'empty' || $this->operator == 'not empty') {
    $value = NULL;
    if ($this->operator == 'empty') {
      $this->operator = "IS NULL";
    }
    else {
      $this->operator = "IS NOT NULL";
    }
  }
  $this->query
    ->add_where($this->options['group'], $this->table_alias . '.' . $this->real_field, $value, $this->operator);
}