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.
36 lines
831 B
PHP
36 lines
831 B
PHP
<?php
|
|
|
|
namespace Plugi\Extensions\Form\Finishers;
|
|
|
|
class FinishersRepository {
|
|
private $config;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->config = require __DIR__ . '/config.php';
|
|
}
|
|
|
|
public function getFinisherConfig (string $key) : array|null
|
|
{
|
|
return $this->config['finishers'][$key] ?? null;
|
|
}
|
|
|
|
public function getEditorConfig(): array
|
|
{
|
|
$editorConfig = [];
|
|
foreach ($this->config['finishers'] as $key => $config) {
|
|
$editorConfig[$key] = [
|
|
'label' => $config['label'] ?? $key,
|
|
'settings' => $config['settings'] ?? [],
|
|
];
|
|
}
|
|
|
|
return $editorConfig;
|
|
}
|
|
|
|
public function finisherExists (string $key) : bool
|
|
{
|
|
return array_key_exists($key, $this->config['finishers']);
|
|
}
|
|
}
|