gform_paypal_config_validation

gform_paypal_config_validation

DescriptionUsageParametersExamplesSource Code

Description
Used to validate custom settings/meta specified using the gform_paypal_action_fields or gform_paypal_add_option_group action hooks.
Usage
add_filter( 'gform_paypal_config_validation', 'your_function_name' );

Parameters

$is_validation_error boolean
Boolean value indicating whether there was a validation error with the PayPal configuration.

$feed Feed Object
The PayPal feed configuration array.

Examples
This example shows how to validate fictional custom options added to integrate with a fictional third party application. This assumes that the custom fields were added to the PayPal configuration form using the gform_paypal_action_fields or gform_paypal_add_option_group hook.
add_filter( 'gform_paypal_config_validation', 'validate_custom_config', 10, 2 );
public static function validate_custom_config( $is_validation_error, $feed ) {

$custom_options = rgars( $feed, 'meta/custom_options' );

if ( empty( $custom_options['enable_thirdparty_options'] ) )
return $is_validation_error;

if ( empty( $custom_options['thirdparty_apikey'] ) || empty( $custom_options['thirdparty_apipass'] ) )
return true;

return $is_validation_error;
}

Source Code
apply_filters( 'gform_paypal_config_validation', false, $feed )

This action hook is located in GFPayPal::save_feed_settings() class-gf-paypal.php.

發表回覆

您的郵箱地址不會被公開。 必填項已用 * 標註