# give/4.16.8.1/src/Donations/CustomFields/Controllers/DonationDetailsController.php

GiveWP – Donation Plugin and Fundraising Platform, version 4.16.8.1. 41 lines.

- Page: https://pluginprobe.com/plugins/give/4.16.8.1/code/src/Donations/CustomFields/Controllers/DonationDetailsController.php
- Raw: https://pluginprobe.com/plugins/give/4.16.8.1/raw/src/Donations/CustomFields/Controllers/DonationDetailsController.php
- Modified: 2025-03-31T19:17:16+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/give/4.16.8.1/code/src/Donations/CustomFields/Controllers/DonationDetailsController.php#L10-L20`.

```php
<?php

namespace Give\Donations\CustomFields\Controllers;

use Give\DonationForms\Models\DonationForm;
use Give\DonationForms\Repositories\DonationFormRepository;
use Give\Donations\CustomFields\Views\DonationDetailsView;
use Give\Donations\Models\Donation;

/**
 * @since 3.0.0
 */
class DonationDetailsController
{
    /**
     * @since 4.0.0 return early if no form is found
     * @since 3.0.0
     */
    public function show(int $donationID): string
    {
        /** @var Donation $donation */
        $donation = Donation::find($donationID);

        if (give(DonationFormRepository::class)->isLegacyForm($donation->formId)) {
            return '';
        }

        $form = DonationForm::find($donation->formId);

        if (!$form) {
            return '';
        }

        $fields = array_filter($form->schema()->getFields(), static function ($field) {
            return $field->shouldShowInAdmin() && !$field->shouldStoreAsDonorMeta();
        });

        return (new DonationDetailsView($donation, $fields))->render();
    }
}

```
