- Fixed UiSelect's selected item method
- Added a new DateTime (WIP from firefox still)
This commit is contained in:
1 parent
e2c1c7ac39
commit
cb2caf895e
5 files changed
+59
-9
No files matched your search
+20
-4
@@ -16,7 +16,10 @@ class Form implements Extension {
|
||||
|
||||
public string $token;
|
||||
|
||||
public function __construct(Context $context) {
|
||||
public ServerRequestInterface $request;
|
||||
|
||||
public function __construct(ServerRequestInterface $request, Context $context) {
|
||||
$this->request = $request;
|
||||
$this->register($context);
|
||||
}
|
||||
|
||||
@@ -43,17 +46,30 @@ class Form implements Extension {
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function formClass(ServerRequestInterface $request) {
|
||||
return new class($request) {
|
||||
public function formClass($form) {
|
||||
return new class($this->request, $form) {
|
||||
|
||||
public bool $sent = false;
|
||||
|
||||
protected ServerRequestInterface $request;
|
||||
|
||||
protected /* FormInterface */ $form;
|
||||
|
||||
public function __construct(ServerRequestInterface $request)
|
||||
public function __construct(ServerRequestInterface $request, /* FormInterface */ $form)
|
||||
{
|
||||
$this->request = $request;
|
||||
$this->sent = $this->requestSent();
|
||||
$this->form = $form;
|
||||
}
|
||||
|
||||
protected function initialize() {
|
||||
$this->form->prepare();
|
||||
|
||||
if ( $this->sent ) {
|
||||
if ( $this->form->validate() ) {
|
||||
$this->form->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function requestSent() : bool
|
||||
|
||||
Reference in new issue
Block a user