| 1 |
<?php |
| 2 |
|
| 3 |
namespace Give\DonationForms\Controllers; |
| 4 |
|
| 5 |
use Give\DonationForms\DataTransferObjects\DonationConfirmationReceiptViewRouteData; |
| 6 |
use Give\DonationForms\ViewModels\DonationConfirmationReceiptViewModel; |
| 7 |
use Give\Donations\Models\Donation; |
| 8 |
|
| 9 |
class DonationConfirmationReceiptViewController |
| 10 |
{ |
| 11 |
/** |
| 12 |
* This renders the donation confirmation receipt view. |
| 13 |
* |
| 14 |
* @since 3.0.0 |
| 15 |
*/ |
| 16 |
public function show(DonationConfirmationReceiptViewRouteData $data): string |
| 17 |
{ |
| 18 |
if (!$data->receiptId) { |
| 19 |
return ''; |
| 20 |
} |
| 21 |
|
| 22 |
$donation = give()->donations->getByReceiptId($data->receiptId); |
| 23 |
|
| 24 |
if (!$donation) { |
| 25 |
return ''; |
| 26 |
} |
| 27 |
|
| 28 |
/** |
| 29 |
* Fires before the donation confirmation receipt view is rendered. |
| 30 |
* |
| 31 |
* @since 3.4.0 |
| 32 |
* |
| 33 |
* @param Donation $donation |
| 34 |
*/ |
| 35 |
do_action('givewp_donation_confirmation_receipt_showing', $donation); |
| 36 |
|
| 37 |
ob_clean(); |
| 38 |
return (new DonationConfirmationReceiptViewModel($donation))->render(); |
| 39 |
} |
| 40 |
} |
| 41 |
|