You are here

public function ViewsAddButtonTrait::getQueryString in Views Add Button 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/views/ViewsAddButtonTrait.php \Drupal\views_add_button\Plugin\views\ViewsAddButtonTrait::getQueryString()
2 calls to ViewsAddButtonTrait::getQueryString()
ViewsAddButtonArea::render in src/Plugin/views/area/ViewsAddButtonArea.php
Render the area.
ViewsAddButtonField::render in src/Plugin/views/field/ViewsAddButtonField.php
Renders the field.

File

src/Plugin/views/ViewsAddButtonTrait.php, line 17

Class

ViewsAddButtonTrait

Namespace

Drupal\views_add_button\Plugin\views

Code

public function getQueryString($values = NULL) {
  $query_string = $this->options['query_string'];
  $q = NULL;
  if (isset($value->index)) {
    $q = $this->options['tokenize'] ? $this
      ->tokenizeValue($query_string, $values->index) : $query_string;
  }
  else {
    $q = $this->options['tokenize'] ? $this
      ->tokenizeValue($query_string) : $query_string;
  }
  $query_opts = [];
  if ($q) {
    $q = $this
      ->viewsAddButtonCleanupSpecialCharacters($q);
    $qparts = explode('&', $q);
    foreach ($qparts as $part) {
      $p = explode('=', $part);
      if (is_array($p) && count($p) > 1) {
        $query_opts[$p[0]] = $p[1];
      }
    }
  }
  return $query_opts;
}