function QueryParameter::getArgument

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/argument_default/QueryParameter.php \Drupal\views\Plugin\views\argument_default\QueryParameter::getArgument()
  2. 10 core/modules/views/src/Plugin/views/argument_default/QueryParameter.php \Drupal\views\Plugin\views\argument_default\QueryParameter::getArgument()
  3. 11.x core/modules/views/src/Plugin/views/argument_default/QueryParameter.php \Drupal\views\Plugin\views\argument_default\QueryParameter::getArgument()

Overrides ArgumentDefaultPluginBase::getArgument

File

core/modules/views/src/Plugin/views/argument_default/QueryParameter.php, line 65

Class

QueryParameter
A query parameter argument default handler.

Namespace

Drupal\views\Plugin\views\argument_default

Code

public function getArgument() {
    $current_request = $this->view
        ->getRequest();
    if ($current_request->query
        ->has($this->options['query_param'])) {
        $param = $current_request->query
            ->get($this->options['query_param']);
        if (is_array($param)) {
            $conjunction = $this->options['multiple'] == 'and' ? ',' : '+';
            $param = implode($conjunction, $param);
        }
        return $param;
    }
    else {
        // Otherwise, use the fixed fallback value.
        return $this->options['fallback'];
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.