public function JobItemState::query

File

src/Plugin/views/filter/JobItemState.php, line 63

Class

JobItemState
Filter based on job item state.

Namespace

Drupal\tmgmt\Plugin\views\filter

Code

public function query() {
  $key = reset($this->value);
  $field = $this->field;
  $table = $this->table;
  switch ($key) {
    case 'open_job_items':
      $this->query
        ->addWhere($this->options['group'], "{$table}.{$field}", [
        0,
        1,
        2,
      ], 'IN');
      break;
    default:
      $state_definitions = JobItem::getStateDefinitions();
      if ($state_definitions[$key]['type'] == 'translator_state') {
        $field = 'translator_state';
      }
      $this->query
        ->addWhere($this->options['group'], "{$table}.{$field}", $key, '=');
      break;
  }
}