Created
February 9, 2016 21:55
-
-
Save tyxla/f884e1710c13e723bfe2 to your computer and use it in GitHub Desktop.
Fix Signature Gravity Forms field
This file contains hidden or 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 | |
add_filter( 'gform_get_form_filter', 'my_fix_gform_signature_field', 99, 2 ); | |
function my_fix_gform_signature_field( $form_string, $form ) { | |
$replacements = array( | |
"~<canvas id='input_\d+_~" => "<canvas id='input_" . $form['id'] . "_", | |
"~id='input_\d+_(\d+)_Container'~" => "id='input_" . $form['id'] . "_$1_Container'", | |
); | |
foreach ( $replacements as $find => $replace ) { | |
$form_string = preg_replace( $find, $replace, $form_string ); | |
} | |
return $form_string; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment