- Added form context defined property
This commit is contained in:
parent
23f24fef50
commit
6ccf07825a
@ -25,14 +25,14 @@ class FormContext implements FormContextInterface
|
|||||||
|
|
||||||
public bool $formSkipCsrf = false;
|
public bool $formSkipCsrf = false;
|
||||||
|
|
||||||
|
protected array $formContextDefinedProperties = [];
|
||||||
|
|
||||||
protected array $formContextCatchedMethods = [ 'POST', 'PUT', 'PATCH', 'DELETE', ];
|
protected array $formContextCatchedMethods = [ 'POST', 'PUT', 'PATCH', 'DELETE', ];
|
||||||
|
|
||||||
public ServerRequestInterface $formContextRequest;
|
public ServerRequestInterface $formContextRequest;
|
||||||
|
|
||||||
public ? ResponseInterface $formContextResponse = null;
|
public ? ResponseInterface $formContextResponse = null;
|
||||||
|
|
||||||
public FormInterface $form;
|
|
||||||
|
|
||||||
public function __construct(ServerRequestInterface $request, ? string $formName = null)
|
public function __construct(ServerRequestInterface $request, ? string $formName = null)
|
||||||
{
|
{
|
||||||
$this->formContextRequest = $request;
|
$this->formContextRequest = $request;
|
||||||
@ -177,6 +177,7 @@ class FormContext implements FormContextInterface
|
|||||||
foreach($this->formContextValues as $property => $value) {
|
foreach($this->formContextValues as $property => $value) {
|
||||||
if ($this->canWriteProperty($property)) {
|
if ($this->canWriteProperty($property)) {
|
||||||
$this->$property = $value;
|
$this->$property = $value;
|
||||||
|
$this->formContextDefinedProperties[$property] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -188,4 +189,9 @@ class FormContext implements FormContextInterface
|
|||||||
|
|
||||||
return ! in_array(strtolower($property), $skipping) && property_exists($this, $property);
|
return ! in_array(strtolower($property), $skipping) && property_exists($this, $property);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function definedProperty(string $property) : bool
|
||||||
|
{
|
||||||
|
return $this->formContextDefinedProperties[$property] ?? false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user