FormActionHandler.php
31 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Kirki\App\Contracts; |
| 4 | |
| 5 | use Exception; |
| 6 | |
| 7 | defined('ABSPATH') || exit; |
| 8 | |
| 9 | use Kirki\App\DTO\Form\FormConfigDTO; |
| 10 | |
| 11 | /** |
| 12 | * A single form-submission action channel (email, webhook, mail client, ...). |
| 13 | * |
| 14 | * Each handler runs one configured action of its type. The dispatcher routes |
| 15 | * actions by type, so handlers stay fully independent — a new or changed |
| 16 | * handler can never break another. |
| 17 | */ |
| 18 | interface FormActionHandler |
| 19 | { |
| 20 | /** |
| 21 | * Run a single configured action for the given submission. |
| 22 | * |
| 23 | * @param array $action A single configured action of this handler's type. |
| 24 | * @param array $form_data The submission data. |
| 25 | * @param FormConfigDTO $form_config The form configuration. |
| 26 | * @return bool Whether it succeeded. Fire-and-forget channels return true. |
| 27 | * @throws Exception on error |
| 28 | */ |
| 29 | public function handle(array $action, array $form_data, FormConfigDTO $form_config); |
| 30 | } |
| 31 |