Skip to content

FinDock hooks

The FinDock add-on starts payments through Salesforce and FinDock. These hooks change what a form editor can pick in the FinDock feed settings, and how a payment is classified, or reported when it could not be started.

Filter · includes/gravityforms/addons/class-findockaddon.php

Filters the condition used to load the Salesforce Campaigns shown in the feed settings. By default no condition is used and all campaigns are loaded.

Parameter Type Description
$where string A SOQL condition. Default ''.

Returns: string — the SOQL condition. The string is sent as is, so only build it from trusted values and escape any value you add.

add_filter('cs_forms_findock_campaigns_filter', function ($where) {
return "IsActive = true AND Type = 'Fundraising'";
});

Filter · includes/gravityforms/addons/class-findockaddon.php

Filters the condition used to load the Salesforce Destinations shown in the feed settings. By default no condition is used. It only runs when a destination object is configured.

Parameter Type Description
$where string A SOQL condition. Default ''.

Returns: string — the SOQL condition. The string is sent as is, so only build it from trusted values and escape any value you add.

add_filter('cs_forms_findock_destinations_filter', function ($where) {
return 'IsActive__c = true';
});

Filter · includes/gravityforms/addons/class-findockaddon.php

Filters the options of the Campaign select in the feed settings. The field is only shown when at least one campaign was loaded.

Parameter Type Description
$choices array[] Options, each with label (Name (Id)) and value (the campaign ID).

Returns: array[] — the options.

add_filter('cs_forms_findock_campaigns_choices', function ($choices) {
usort($choices, fn ($a, $b) => strcasecmp($a['label'], $b['label']));
return $choices;
});

Filter · includes/gravityforms/addons/class-findockaddon.php

Filters the options of the Destination select in the feed settings. The field is only shown when at least one destination was loaded.

Parameter Type Description
$choices array[] Options, each with label (Name (Id)) and value (the destination ID).

Returns: array[] — the options.

add_filter('cs_forms_findock_destinations_choices', function ($choices) {
return array_values(array_filter($choices, fn ($choice) => stripos($choice['label'], 'archive') === false));
});

Filter · includes/gravityforms/addons/class-findockaddon.php

Filters the labels of the payment method parameters in the “Payment method fields” mapping. The keys are FinDock parameter names such as brand, iban or holderName. A parameter without a label here is shown by its name.

Parameter Type Description
$labels array<string, string> Labels keyed by parameter name. The default list covers the common parameters.
$payment_method_config array The payment method configuration, keyed by payment method ID.

Returns: array<string, string> — the labels.

add_filter('cs_forms_findock_payment_method_labels', function ($labels, $payment_method_config) {
$labels['iban'] = __('IBAN of the donor', 'my-plugin');
return $labels;
}, 10, 2);

Filter · includes/gravityforms/addons/class-findockaddon.php

Filters the payment type saved on the CampaignSuite payment. By default it is one-time when the mapped frequency is empty or one-time (case-insensitive), and recurring otherwise.

Parameter Type Description
$payment_type string one-time or recurring.
$entry array The Gravity Forms entry.
$form array The form object.
$cs_entry \CampaignSuite\Core\Includes\Post_Types\Payment The CampaignSuite payment.

Returns: string — the payment type.

add_filter('cs_forms_findock_payment_type', function ($payment_type, $entry, $form, $cs_entry) {
return strtolower((string) rgar($entry, '7')) === 'once-a-year' ? 'recurring' : $payment_type;
}, 10, 4);

Filter · includes/gravityforms/addons/class-findockaddon.php

Filters the message shown in place of the confirmation when the payment could not be started. The default is “Your payment could not be started. Please try again later.” The message is escaped with esc_html() after the filter, so return plain text.

Parameter Type Description
$message string The message.
$form array The form object.
$entry array The Gravity Forms entry.

Returns: string — the message as plain text.

add_filter('cs_forms_findock_failed_message', function ($message, $form, $entry) {
return __('We could not start your donation. Please try again or contact us.', 'my-plugin');
}, 10, 3);