Last active
June 8, 2023 07:33
-
-
Save wpfullstripe/ff544c91b8ee6efce3e081027f3d9b59 to your computer and use it in GitHub Desktop.
The fullstripe_form_field_configuration Wordpress filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* A 'fullstripe_form_field_configuration' filter hook example for WP Full Pay. | |
* | |
* @param array $config The field configuration returned by the previous filter instance. | |
* @param array $params with the following keys: | |
* formName => Name of the form. | |
* formType => Type of the form. Possible values: | |
* inline_payment | |
* checkout_payment | |
* inline_subscription | |
* checkout_subscription | |
* inline_donation | |
* checkout_donation | |
* inline_save_card | |
* checkout_save_card | |
* | |
* @return array Field configuration | |
*/ | |
function formFieldConfiguration( $config, $params ) { | |
$result = $config; | |
$formName = $params['formName']; | |
if ( $formName === 'payment' ) { | |
WPFS_API_v2::setIsFormFieldConfigurable( $result, 'cardholdersName', true ); | |
WPFS_API_v2::setIsFormFieldConfigurable( $result, 'email', true ); | |
WPFS_API_v2::setIsFormFieldReadonly( $result, 'email', true ); | |
} | |
return $result; | |
} | |
add_filter('fullstripe_form_field_configuration', 'formFieldConfiguration', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment