- Worked with the files begin on the context part
This commit is contained in:
parent
e75d997b02
commit
0d9db0470e
|
@ -6,8 +6,8 @@ class UiFile extends UiInput {
|
|||
|
||||
public string $token = "ui.file";
|
||||
|
||||
public array $attributes = [
|
||||
'class' => "ui-file",
|
||||
'type' => "file",
|
||||
];
|
||||
}
|
||||
public array $attributes = [
|
||||
'class' => "ui-file",
|
||||
'type' => "file",
|
||||
];
|
||||
}
|
|
@ -10,9 +10,13 @@ class FormContext implements FormContextInterface
|
|||
public string $formName;
|
||||
|
||||
public bool $formSent;
|
||||
|
||||
|
||||
public bool $formExecuted = false;
|
||||
|
||||
public array $values = [];
|
||||
|
||||
public array $files = [];
|
||||
|
||||
public array $messages = [];
|
||||
|
||||
public ServerRequestInterface $request;
|
||||
|
@ -28,6 +32,8 @@ class FormContext implements FormContextInterface
|
|||
}
|
||||
|
||||
$this->values = $request->getParsedBody() ?: [];
|
||||
|
||||
$this->files = $request->getUploadedFiles() ?: [];
|
||||
}
|
||||
|
||||
public function valid() : bool
|
||||
|
@ -40,7 +46,12 @@ class FormContext implements FormContextInterface
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function executed() : bool
|
||||
{
|
||||
return $this->formExecuted;
|
||||
}
|
||||
|
||||
public function formSent() : bool
|
||||
{
|
||||
return $this->formSent;
|
||||
|
|
|
@ -50,6 +50,8 @@ class FormHandler {
|
|||
if ( $this->sent ) {
|
||||
if ( $this->form->validate($this->context) ) {
|
||||
$this->executionStatus = $this->form->execute($this->context);
|
||||
|
||||
$this->context->formExecuted = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,5 +8,5 @@ interface FormInterface
|
|||
|
||||
public function validate(FormContextInterface $context) : bool;
|
||||
|
||||
public function execute(FormContextInterface $context) : void;
|
||||
public function execute(FormContextInterface $context) /* : mixed */;
|
||||
}
|
Loading…
Reference in New Issue