mirror of
https://github.com/getgrav/grav.git
synced 2026-07-05 18:37:30 +02:00
Fixed Route::withQueryParam() to accept array values
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
* Added `Grav\Common\Page` interface to allow custom page types in the future
|
||||
1. [](#bugfix)
|
||||
* Fixed bug in `ContentBlock` serialization
|
||||
* Fixed `Route::withQueryParam()` to accept array values
|
||||
|
||||
# v1.4.4
|
||||
## 04/12/2018
|
||||
|
||||
@@ -178,7 +178,7 @@ class Route
|
||||
*/
|
||||
public function withGravParam($param, $value)
|
||||
{
|
||||
return $this->withParam('gravParams', $param, $value);
|
||||
return $this->withParam('gravParams', $param, null !== $value ? (string)$value : null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -222,17 +222,16 @@ class Route
|
||||
protected function withParam($type, $param, $value)
|
||||
{
|
||||
$oldValue = isset($this->{$type}[$param]) ? $this->{$type}[$param] : null;
|
||||
$newValue = null !== $value ? (string)$value : null;
|
||||
|
||||
if ($oldValue === $newValue) {
|
||||
if ($oldValue === $value) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
$new = clone $this;
|
||||
if ($newValue === null) {
|
||||
if ($value === null) {
|
||||
unset($new->{$type}[$param]);
|
||||
} else {
|
||||
$new->{$type}[$param] = $newValue;
|
||||
$new->{$type}[$param] = $value;
|
||||
}
|
||||
|
||||
return $new;
|
||||
|
||||
Reference in New Issue
Block a user