You are here

protected function MultiRangesTrait::breakPhraseRange in Views Contextual Range Filter 8

Break xfrom--xto+yfrom--yto+zfrom--zto into an array of ranges.

Parameters

string $str: The string to parse.

5 calls to MultiRangesTrait::breakPhraseRange()
DateRange::query in src/Plugin/views/argument/DateRange.php
Prepare the range query where clause.
DateRange::title in src/Plugin/views/argument/DateRange.php
Title override.
NumericRangeArgument::query in src/Plugin/views/argument/NumericRangeArgument.php
Create the query.
NumericRangeArgument::title in src/Plugin/views/argument/NumericRangeArgument.php
Title override.
StringRangeArgument::query in src/Plugin/views/argument/StringRangeArgument.php
Build the query.

File

src/Plugin/views/argument/MultiRangesTrait.php, line 16

Class

MultiRangesTrait
Common member functions for Views contextual range argument plugins.

Namespace

Drupal\contextual_range_filter\Plugin\views\argument

Code

protected function breakPhraseRange($str) {
  if (empty($str)) {
    return;
  }
  $this->value = preg_split('/[+ ]/', $str);
  $this->operator = 'or';

  // Keep an 'error' value if invalid ranges were given.
  // A single non-empty value is ok, but a plus sign without values is not.
  if (count($this->value) > 1 && (empty($this->value[0]) || empty($this->value[1]))) {
    $this->value = FALSE;
  }
}