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.
99 lines
3.5 KiB
PHP
99 lines
3.5 KiB
PHP
<?php
|
|
|
|
return [
|
|
'finishers' => [
|
|
'saveToDatabase' => [
|
|
'class' => \Plugi\Extensions\Form\Finishers\SaveEntryToDatabase::class,
|
|
'label' => 'Save to database',
|
|
'settings' => [],
|
|
],
|
|
'sendMailToAdmin' => [
|
|
'class' => \Plugi\Extensions\Form\Finishers\SendEmailToAdmin::class,
|
|
'label' => 'Send email to admin',
|
|
'settings' => [
|
|
[
|
|
'name' => 'recipient',
|
|
'label' => 'Recipient email',
|
|
'type' => 'email',
|
|
'default' => '',
|
|
'placeholder' => 'Uses the form extension default when blank',
|
|
],
|
|
[
|
|
'name' => 'subject',
|
|
'label' => 'Subject',
|
|
'type' => 'text',
|
|
'default' => '',
|
|
'placeholder' => 'Uses the form name when blank',
|
|
],
|
|
],
|
|
],
|
|
'sendConfirmationEmailToSubmitter' => [
|
|
'class' => \Plugi\Extensions\Form\Finishers\SendConfirmationEmailToSubmitter::class,
|
|
'label' => 'Send confirmation email to submitter',
|
|
'settings' => [
|
|
[
|
|
'name' => 'recipientField',
|
|
'label' => 'Recipient email field',
|
|
'type' => 'emailField',
|
|
'default' => '',
|
|
'required' => true,
|
|
],
|
|
[
|
|
'name' => 'subject',
|
|
'label' => 'Subject',
|
|
'type' => 'text',
|
|
'default' => 'Thank you for your submission',
|
|
'required' => true,
|
|
],
|
|
[
|
|
'name' => 'message',
|
|
'label' => 'Message',
|
|
'type' => 'textarea',
|
|
'default' => 'Thank you for contacting us. We have received your message.',
|
|
'required' => true,
|
|
],
|
|
],
|
|
],
|
|
'sendWebhook' => [
|
|
'class' => \Plugi\Extensions\Form\Finishers\SendWebhook::class,
|
|
'label' => 'Send webhook',
|
|
'settings' => [
|
|
[
|
|
'name' => 'url',
|
|
'label' => 'Webhook URL',
|
|
'type' => 'url',
|
|
'default' => '',
|
|
'required' => true,
|
|
'placeholder' => 'https://example.com/webhook',
|
|
'help' => 'Receives a JSON object with the form ID, form name, and submitted fields.',
|
|
],
|
|
[
|
|
'name' => 'method',
|
|
'label' => 'HTTP method',
|
|
'type' => 'select',
|
|
'default' => 'POST',
|
|
'options' => [
|
|
['value' => 'POST', 'label' => 'POST'],
|
|
['value' => 'PUT', 'label' => 'PUT'],
|
|
],
|
|
],
|
|
[
|
|
'name' => 'bearerToken',
|
|
'label' => 'Bearer token (optional)',
|
|
'type' => 'password',
|
|
'default' => '',
|
|
],
|
|
[
|
|
'name' => 'timeout',
|
|
'label' => 'Timeout (seconds)',
|
|
'type' => 'number',
|
|
'default' => 10,
|
|
'min' => 1,
|
|
'max' => 30,
|
|
'required' => true,
|
|
],
|
|
],
|
|
],
|
|
]
|
|
];
|