| @@ -39,8 +39,9 @@ | ||
| 39 | 39 | private string $mailOptIn = ''; |
| 40 | 40 | private string $email = ''; |
| 41 | 41 | private string $consentText = ''; |
| 42 | 42 | private string $consentField = ''; |
| 43 | + private string $formRef = ''; | |
| 43 | 44 | private int $reminderSentAt = 0; |
| 44 | 45 | private string $mailReminder = ''; |
| 45 | 46 | |
| 46 | 47 | /** |
| @@ -96,8 +97,9 @@ | ||
| 96 | 97 | $optIn->mailOptIn = (string) ( $data['mail_optin'] ?? '' ); |
| 97 | 98 | $optIn->email = (string) ( $data['email'] ?? '' ); |
| 98 | 99 | $optIn->consentText = (string) ( $data['consent_text'] ?? '' ); |
| 99 | 100 | $optIn->consentField = (string) ( $data['consent_field'] ?? '' ); |
| 101 | + $optIn->formRef = (string) ( $data['form_ref'] ?? '' ); | |
| 100 | 102 | $optIn->reminderSentAt = self::parseTimestamp( $data['reminder_sent_at'] ?? 0 ); |
| 101 | 103 | $optIn->mailReminder = (string) ( $data['mail_reminder'] ?? '' ); |
| 102 | 104 | |
| 103 | 105 | return $optIn; |
| @@ -138,8 +140,9 @@ | ||
| 138 | 140 | 'mail_optin' => $this->mailOptIn, |
| 139 | 141 | 'email' => $this->email, |
| 140 | 142 | 'consent_text' => $this->consentText, |
| 141 | 143 | 'consent_field' => $this->consentField, |
| 144 | + 'form_ref' => $this->formRef, | |
| 142 | 145 | 'reminder_sent_at' => $this->reminderSentAt > 0 ? gmdate( 'Y-m-d H:i:s', $this->reminderSentAt ) : '', |
| 143 | 146 | 'mail_reminder' => $this->mailReminder, |
| 144 | 147 | ); |
| 145 | 148 | } |
| @@ -309,8 +312,16 @@ | ||
| 309 | 312 | public function getConsentField(): string { |
| 310 | 313 | return $this->consentField; |
| 311 | 314 | } |
| 312 | 315 | |
| 316 | + /** | |
| 317 | + * Instance of the form inside the form id, e.g. the Elementor widget id. | |
| 318 | + * Empty means the record is tied to the whole form (or page) only. | |
| 319 | + */ | |
| 320 | + public function getFormRef(): string { | |
| 321 | + return $this->formRef; | |
| 322 | + } | |
| 323 | + | |
| 313 | 324 | public function getReminderSentAt(): int { |
| 314 | 325 | return $this->reminderSentAt; |
| 315 | 326 | } |
| 316 | 327 | |
| @@ -510,8 +521,14 @@ | ||
| 510 | 521 | |
| 511 | 522 | public function withConsentField( string $consentField ): self { |
| 512 | 523 | $clone = clone $this; |
| 513 | 524 | $clone->consentField = $consentField; |
| 525 | + return $clone; | |
| 526 | + } | |
| 527 | + | |
| 528 | + public function withFormRef( string $formRef ): self { | |
| 529 | + $clone = clone $this; | |
| 530 | + $clone->formRef = $formRef; | |
| 514 | 531 | return $clone; |
| 515 | 532 | } |
| 516 | 533 | |
| 517 | 534 | public function withReminderSentAt( int $time ): self { |