Skip to content

Instantly share code, notes, and snippets.

@cfxd
Last active August 29, 2015 14:16
Show Gist options
  • Save cfxd/76b462db9572aead2468 to your computer and use it in GitHub Desktop.
Save cfxd/76b462db9572aead2468 to your computer and use it in GitHub Desktop.
Change Gravity Forms <input> into a <button> while preserving attributes and custom submit text.
function gf_make_submit_input_into_a_button_element($button_input, $form) {
preg_match("/<input([^\/>]*)(\s\/)*>/", $button_input, $button_match);
$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