From deacd0dfc195bca41af631114804d29937337cd8 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 17 Jan 2024 02:11:31 +0900 Subject: . --- services/app/src/Form/FormBase.php | 53 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 services/app/src/Form/FormBase.php (limited to 'services/app/src/Form/FormBase.php') diff --git a/services/app/src/Form/FormBase.php b/services/app/src/Form/FormBase.php new file mode 100644 index 0000000..cc29442 --- /dev/null +++ b/services/app/src/Form/FormBase.php @@ -0,0 +1,53 @@ +, state: array, errors: array} + */ + public function toTemplateVars(): array + { + return [ + 'action' => $this->action(), + 'submit_label' => $this->submitLabel(), + 'items' => $this->items(), + 'state' => $this->state->getParams(), + 'errors' => $this->state->getErrors(), + ]; + } + + abstract public function pageTitle(): string; + + abstract public function redirectUrl(): string; + + protected function action(): ?string + { + return null; + } + + abstract protected function submitLabel(): string; + + /** + * @return list + */ + abstract protected function items(): array; + + /** + * @return array + */ + public function getRenderContext(): array + { + return []; + } + + abstract public function submit(): void; +} -- cgit v1.2.3-70-g09d2