• File: ReplaceGiveReceiptShortcodeViewWithDonationConfirmationIframe.php
  • Full Path: /home/bravrvjk/itiministry.org/wp-content/plugins/give/src/DonationForms/Actions/ReplaceGiveReceiptShortcodeViewWithDonationConfirmationIframe.php
  • Date Modified: 08/28/2024 10:13 PM
  • File size: 764 bytes
  • MIME-type: text/x-php
  • Charset: utf-8
<?php

namespace Give\DonationForms\Actions;

use Give\DonationForms\DataTransferObjects\DonationConfirmationReceiptViewRouteData;

class ReplaceGiveReceiptShortcodeViewWithDonationConfirmationIframe
{
    /**
     * Replace the give_receipt shortcode with the v3 confirmation page iframe.
     *
     * @since 3.16.0
     */
    public function __invoke(string $view): string
    {
        $data = DonationConfirmationReceiptViewRouteData::fromRequest(give_clean($_GET));

        if ($data->receiptId) {
            $viewUrl = (new GenerateDonationConfirmationReceiptViewRouteUrl())($data->receiptId);
            return "<iframe style='width: 1px;min-width: 100%;border: 0;' data-givewp-embed src='$viewUrl'></iframe>";
        }

        return $view;
    }
}