Last active
August 29, 2015 14:17
-
-
Save vanbernaert/cfc80b5d702c5d290658 to your computer and use it in GitHub Desktop.
Gravity forms, replace <input type="submit> element with a <button> element
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
// credits: https://github.com/CFXd | |
function gf_make_submit_input_into_a_button_element($button_input, $form) { | |
//save attribute string to $button_match[1] | |
preg_match("/<input([^\/>]*)(\s\/)*>/", $button_input, $button_match); | |
//remove value attribute | |
$button_atts = str_replace("value='".$form['button']['text']."' ", "", $button_match[1]); | |
return '<button '.$button_atts.'>'.$form['button']['text'].'<i class="fa fa-refresh"></i></button>'; | |
} | |
add_filter('gform_submit_button', 'gf_make_submit_input_into_a_button_element', 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment