From a34ebaf0df168c58bff4a14473e125ab236e779c Mon Sep 17 00:00:00 2001 From: Dave Mc Nicoll Date: Fri, 1 Nov 2024 16:12:57 -0400 Subject: [PATCH] - Fixed executed() method and added a new method handling in UiForm --- src/Form/UiForm.php | 7 ++++--- src/Method/FormContext.php | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Form/UiForm.php b/src/Form/UiForm.php index 546a730..97507e2 100644 --- a/src/Form/UiForm.php +++ b/src/Form/UiForm.php @@ -68,7 +68,8 @@ class UiForm extends UiElement implements Extension { public function buildHtml(string $method = "get", string $name = "", string $action = "", array $attributes = []) : string { - $method = strtolower($method); + # Method passed in arguments take precedents over options + $method = strtolower($attributes['method'] ?? $method); $this->option('tag-type', 'single'); @@ -77,8 +78,8 @@ class UiForm extends UiElement implements Extension { unset($this->attributes['class']); } - $this->attributes([ 'method' => $method, 'action' => $action ] + $attributes); - + $this->attributes([ 'action' => $action, 'method' => $method, ] + $attributes); + if ( $method !== "get" ) { if ($this->csrf) { diff --git a/src/Method/FormContext.php b/src/Method/FormContext.php index a048490..a08d86d 100644 --- a/src/Method/FormContext.php +++ b/src/Method/FormContext.php @@ -73,7 +73,7 @@ class FormContext implements FormContextInterface public function executed() : bool { - return $this->formExecuted; + return $this->formExecutionStatus === false ? false : $this->formExecuted; } public function formSent() : bool