Skip to content

Commit

Permalink
Added 'request' attribute change
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Robert committed Jan 11, 2022
1 parent 5d0b2ff commit 685a980
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion Chase/Safari/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,15 @@ public function __construct(array $request)

public function __set($name, $value)
{
$this->attributes[$name] = $value;
if($name === 'request'){
if(!is_array($value)){
throw new \Error("Form attribute 'request' must have an array value.");
}
$request = Utils::cleanGlobal($value);
$this->builder = new ElementBuilder($request);
}else{
$this->attributes[$name] = $value;
}
}

public function __get($name)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Or with different form attributes

```php
$login = new LoginForm;
echo $login->with("method", "GET")->with("action", "/")->render()
echo $login->with("method", "GET")->with("action", "/")->with("request", $_GET)->render()
```

## Code Sample
Expand Down

0 comments on commit 685a980

Please sign in to comment.