#18 - membership

This commit was merged in pull request #23.
This commit is contained in:
Martin Slachta
2026-06-17 11:15:09 +02:00
parent df5f9b1df4
commit c754e18a82
25 changed files with 885 additions and 35 deletions
+13 -1
View File
@@ -7,10 +7,12 @@ class RsvFormDefinition {
public string $email_key = "";
public array $membership = [];
public string $success_message = "";
/**
* @param array<int,mixed> $definition Full definition array including 'elements', 'email_key' and 'success_message'.
* @param array<string,mixed> $definition Full definition array including 'elements', 'email_key' and 'success_message'.
*/
public function __construct(string $id, array $definition) {
$this->_elements = [];
@@ -23,6 +25,7 @@ class RsvFormDefinition {
$this->_id = $id;
$this->email_key = $definition['email_key'] ?? '';
$this->membership = $definition['membership'] ?? [];
$this->success_message = $definition['success_message'] ?? '';
}
@@ -34,6 +37,15 @@ class RsvFormDefinition {
return $this->email_key;
}
/** @return array<int,array{program_id:int,discount:float,field:string}> */
public function getMembershipBindings(): array {
return $this->membership['bindings'] ?? [];
}
public function getMembershipCombine(): string {
return $this->membership['combine'] ?? 'max';
}
/** Template shown to the visitor after a successful submission. */
public function getSuccessMessage(): string {
return $this->success_message;