(#3) - templating

This commit is contained in:
Martin Slachta
2026-06-14 07:16:13 +02:00
parent 37bced77f4
commit 7b3d9f0ece
32 changed files with 870 additions and 126 deletions
+11 -3
View File
@@ -7,8 +7,10 @@ class RsvFormDefinition {
public string $email_key = "";
public string $success_message = "";
/**
* @param array<int,mixed> $definition Full definition array including 'elements' and 'email_key'.
* @param array<int,mixed> $definition Full definition array including 'elements', 'email_key' and 'success_message'.
*/
public function __construct(string $id, array $definition) {
$this->_elements = [];
@@ -19,8 +21,9 @@ class RsvFormDefinition {
}
}
$this->_id = $id;
$this->email_key = $definition['email_key'] ?? '';
$this->_id = $id;
$this->email_key = $definition['email_key'] ?? '';
$this->success_message = $definition['success_message'] ?? '';
}
public function getId(): string {
@@ -31,6 +34,11 @@ class RsvFormDefinition {
return $this->email_key;
}
/** Template shown to the visitor after a successful submission. */
public function getSuccessMessage(): string {
return $this->success_message;
}
public function hasElements() : bool {
return count($this->_elements) > 0;