- Added form context defined property

This commit is contained in:
Dave Mc Nicoll 2025-09-15 20:04:49 +00:00
parent 23f24fef50
commit 6ccf07825a

View File

@ -25,14 +25,14 @@ class FormContext implements FormContextInterface
public bool $formSkipCsrf = false;
protected array $formContextDefinedProperties = [];
protected array $formContextCatchedMethods = [ 'POST', 'PUT', 'PATCH', 'DELETE', ];
public ServerRequestInterface $formContextRequest;
public ? ResponseInterface $formContextResponse = null;
public FormInterface $form;
public function __construct(ServerRequestInterface $request, ? string $formName = null)
{
$this->formContextRequest = $request;
@ -177,6 +177,7 @@ class FormContext implements FormContextInterface
foreach($this->formContextValues as $property => $value) {
if ($this->canWriteProperty($property)) {
$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);
}
protected function definedProperty(string $property) : bool
{
return $this->formContextDefinedProperties[$property] ?? false;
}
}