# give/4.18.0/src/PaymentGateways/Gateways/Offline/Actions/UpdateOfflineMetaFromFormBuilder.php

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

- Page: https://pluginprobe.com/plugins/give/4.18.0/code/src/PaymentGateways/Gateways/Offline/Actions/UpdateOfflineMetaFromFormBuilder.php
- Raw: https://pluginprobe.com/plugins/give/4.18.0/raw/src/PaymentGateways/Gateways/Offline/Actions/UpdateOfflineMetaFromFormBuilder.php
- Modified: 2023-10-16T17:55:46+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/PaymentGateways/Gateways/Offline/Actions/UpdateOfflineMetaFromFormBuilder.php#L10-L20`.

```php
<?php

namespace Give\PaymentGateways\Gateways\Offline\Actions;

use Give\DonationForms\Models\DonationForm;

/**
 * Updates the Offline gateway meta based on the form builder settings. This is done in order to use the legacy
 * instructions function.
 *
 * @since 3.0.0
 *
 * @see give_get_offline_payment_instruction()
 */
class UpdateOfflineMetaFromFormBuilder
{
    public function __invoke(DonationForm $form)
    {
        $paymentGatewaysBlock = $form->blocks->findByName('givewp/payment-gateways');
        if (!$paymentGatewaysBlock) {
            return;
        }

        [
            'offlineEnabled' => $enabled,
            'offlineUseGlobalInstructions' => $useGlobalInstructions,
            'offlineDonationInstructions' => $donationInstructions,
        ] = $paymentGatewaysBlock->getAttributes() + [
            'offlineEnabled' => true,
            'offlineUseGlobalInstructions' => true,
            'offlineDonationInstructions' => '',
        ];

        if (!$enabled) {
            $modeMeta = 'disabled';
        } elseif ($useGlobalInstructions) {
            $modeMeta = 'global';
        } else {
            $modeMeta = 'enabled';
        }

        give()->form_meta->update_meta(
            $form->id,
            '_give_customize_offline_donations',
            $modeMeta
        );

        give()->form_meta->update_meta(
            $form->id,
            '_give_offline_checkout_notes',
            $donationInstructions
        );
    }
}

```
