You are here

public function StringRangeArgument::query in Views Contextual Range Filter 8

Build the query.

Overrides StringArgument::query

File

src/Plugin/views/argument/StringRangeArgument.php, line 55

Class

StringRangeArgument
Argument handler to accept a string range.

Namespace

Drupal\contextual_range_filter\Plugin\views\argument

Code

public function query($group_by = FALSE) {
  $argument = $this->argument;
  if (!empty($this->options['transform_dash'])) {
    $argument = strtr($argument, '-', ' ');
  }

  // Check "Allow multple ranges" checkbox.
  if (!empty($this->options['break_phrase'])) {
    $this
      ->breakPhraseRange($this->argument);
  }
  else {
    $this->value = [
      $argument,
    ];
  }
  $this
    ->ensureMyTable();
  if (!empty($this->definition['many to one'])) {
    if (!empty($this->options['glossary'])) {
      $this->helper->formula = TRUE;
    }
    $this->helper
      ->ensureMyTable();
    $this->helper
      ->addFilter();
    return;
  }
  if (empty($this->options['glossary'])) {
    $field = "{$this->tableAlias}.{$this->realField}";
  }
  else {
    $field = $this
      ->getFormula();
  }
  ContextualRangeFilter::buildRangeQuery($this, $field);
}