add configurable form finishers and webhook delivery

Expose finisher settings through the editor registry and build the action editor dynamically. Add configurable admin email recipients and subjects, and introduce a webhook finisher with validated request options and JSON submission payloads.

Expand submission handler tests to cover editor configuration, email overrides, webhook validation, HTTP responses, and submission outcomes.
This commit is contained in:
2026-11-24 18:51:20 +01:00
parent dfe1e40e58
commit d5597b045f
6 changed files with 459 additions and 42 deletions
@@ -8,12 +8,28 @@ class SendEmailToAdmin extends DefaultFinisher
public function execute(): bool
{
$settings = Extensions::getSettings('form');
$to = $settings['email']['value'] ?? null;
$to = $this->options['recipient'] ?? '';
if (!is_string($to)) {
return false;
}
if (trim($to) === '') {
$to = $settings['email']['value'] ?? null;
}
if (!is_string($to) || filter_var($to, FILTER_VALIDATE_EMAIL) === false) {
return false;
}
$subject = 'Form submission: '.$this->getFormName();
$subject = $this->options['subject'] ?? '';
if (!is_string($subject)) {
return false;
}
if (trim($subject) === '') {
$subject = 'Form submission: '.$this->getFormName();
}
if (strpbrk($subject, "\r\n") !== false) {
return false;
}
$message = $this->getNiceFields();
$mailer = phpb_instance('mail');
return $mailer !== null && $mailer->send($to, $subject, $message) === true;