← All changes
|
backend/src/Controllers/Confirmation/AddConfirmationController.php
+6
-5
0.8.2
→
1.5
View file →
| @@ -1,13 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace IvyForms\Controllers\Confirmation; |
| 4 | 4 | |
| 5 | -// phpcs:disable PSR1.Files.SideEffects | |
| 6 | -if (!defined('ABSPATH')) { | |
| 7 | - exit; // Exit if accessed directly | |
| 8 | -} | |
| 9 | - | |
| 10 | 5 | use IvyForms\Common\Exceptions\ForbiddenException; |
| 11 | 6 | use IvyForms\Common\Exceptions\InvalidArgumentException; |
| 12 | 7 | use IvyForms\Common\Exceptions\QueryExecutionException; |
| 13 | 8 | use IvyForms\Common\Sanitizer\Sanitizer; |
| @@ -54,8 +49,14 @@ | ||
| 54 | 49 | } |
| 55 | 50 | |
| 56 | 51 | // Sanitize the input data |
| 57 | 52 | $params = Sanitizer::sanitizeConfirmationData($data->get_params()); |
| 53 | + | |
| 54 | + if (empty(trim($params['name'] ?? ''))) { | |
| 55 | + throw new InvalidArgumentException( | |
| 56 | + BackendStrings::getSettingsFormBuilderStrings()['confirmation_name_required'] | |
| 57 | + ); | |
| 58 | + } | |
| 58 | 59 | |
| 59 | 60 | $confirmation = ConfirmationFactory::create($params); |
| 60 | 61 | |
| 61 | 62 | $confirmationId = $this->confirmationService->createConfirmation($confirmation); |