# give/4.18.0/src/Campaigns/Actions/FormInheritsCampaignGoal.php

GiveWP – Donation Plugin and Fundraising Platform, version 4.18.0. 32 lines.

- Page: https://pluginprobe.com/plugins/give/4.18.0/code/src/Campaigns/Actions/FormInheritsCampaignGoal.php
- Raw: https://pluginprobe.com/plugins/give/4.18.0/raw/src/Campaigns/Actions/FormInheritsCampaignGoal.php
- Modified: 2025-04-16T13:25:04+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.18.0/code/src/Campaigns/Actions/FormInheritsCampaignGoal.php#L10-L20`.

```php
<?php

namespace Give\Campaigns\Actions;

use Give\Campaigns\Models\Campaign;
use Give\DonationForms\Models\DonationForm;
use Give\DonationForms\ValueObjects\GoalSource;

/**
 * @since 4.0.0
 *
 * Form inherits campaign goal
 *
 * @event givewp_donation_form_creating
 */
class FormInheritsCampaignGoal
{
    /**
     * @since 4.0.0
     */
    public function __invoke(DonationForm $donationForm): void
    {
        if (isset($_GET['campaignId'])) {
            $campaign = Campaign::find((int)$_GET['campaignId']);

            if ($campaign) {
                $donationForm->settings->goalSource = GoalSource::CAMPAIGN();
            }
        }
    }
}

```
