1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-17 12:10:45 +02:00

Add support for optional overrides array to $input->queryString()

This commit is contained in:
teppokoivula
2016-11-05 14:53:09 +02:00
parent 8d0c8de3ee
commit 0a12932951
2 changed files with 7 additions and 5 deletions

View File

@@ -558,15 +558,17 @@ class WireInput extends Wire {
* Return the unsanitized query string that was part of this request, or blank if none
*
* Note that the returned query string is not sanitized, so if you use it in any output
* be sure to run it through `$sanitizer->entities()` first.
* be sure to run it through `$sanitizer->entities()` first. An optional assoc array
* param can be used to add new GET params or override existing ones.
*
* #pw-group-URLs
*
* @param array $overrides Optional assoc array for overriding or adding GET params
* @return string Returns the unsanitized query string
*
*/
public function queryString() {
return $this->get()->queryString();
public function queryString($overrides = array()) {
return $this->get()->queryString($overrides);
}
/**

View File

@@ -200,8 +200,8 @@ class WireInputData extends Wire implements \ArrayAccess, \IteratorAggregate, \C
$this->offsetUnset($key);
}
public function queryString() {
return http_build_query($this->getArray());
public function queryString($overrides = array()) {
return http_build_query(array_merge($this->getArray(), $overrides));
}
/**