# ivyforms/0.3.1/backend/src/Controllers/Confirmation/GetConfirmationsController.php

The Innovative Form Builder – IvyForms, version 0.3.1. 69 lines.

- Page: https://pluginprobe.com/plugins/ivyforms/0.3.1/code/backend/src/Controllers/Confirmation/GetConfirmationsController.php
- Raw: https://pluginprobe.com/plugins/ivyforms/0.3.1/raw/backend/src/Controllers/Confirmation/GetConfirmationsController.php
- Modified: 2025-09-04T07:37:14+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/ivyforms/0.3.1/code/backend/src/Controllers/Confirmation/GetConfirmationsController.php#L10-L20`.

```php
<?php

/**
 * @copyright © TMS-Plugins. All rights.
 * @licence   See COPYING.md for license details.
 */

namespace IvyForms\Controllers\Confirmation;

// phpcs:disable PSR1.Files.SideEffects
if (!defined('ABSPATH')) {
    exit; // Exit if accessed directly
}

use IvyForms\Common\Exceptions\ForbiddenException;
use IvyForms\Common\Exceptions\InvalidArgumentException;
use IvyForms\Common\Exceptions\NotFoundException;
use IvyForms\Common\Sanitizer\Sanitizer;
use IvyForms\Controllers\Controller;
use IvyForms\Services\Confirmation\ConfirmationService;
use IvyForms\Services\Translations\BackendStrings;
use WP_REST_Request;
use WP_REST_Response;

/**
 * Class GetConfirmationsController
 *
 * @package IvyForms\Controllers\Confirmation
 */
class GetConfirmationsController extends Controller
{
    private ConfirmationService $confirmationService;

    public function __construct(
        ConfirmationService $confirmationService
    ) {
        $this->confirmationService = $confirmationService;
    }

    /**
     * @param WP_REST_Request $data
     *
     * @return WP_REST_Response
     *
     * @throws InvalidArgumentException
     * @throws NotFoundException
     * @throws ForbiddenException
     */
    public function handle(WP_REST_Request $data): WP_REST_Response
    {
        // Verify the nonce
        Sanitizer::verifyNonce($data->get_header('X-WP-Nonce'));
        $formId = Sanitizer::sanitizeId($data->get_param('id'));

        $confirmationsArr = $this->confirmationService->getConfirmationsById($formId);

        $confirmations = [];

        foreach ($confirmationsArr as $confirmation) {
            $confirmations[] = $confirmation->toArray();
        }

        return new WP_REST_Response([
            'message' => BackendStrings::getCommonStrings()['ok'],
            $confirmations
        ], 200);
    }
}

```
