Created
September 7, 2015 21:36
-
-
Save NikV/4bc1e7841c8c64c99a21 to your computer and use it in GitHub Desktop.
Custom class and custom label for Entry Detail Save button
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
function modifygform_entrydetail_update_button() { | |
$mode = empty( $_POST['screen_mode'] ) ? 'view' : $_POST['screen_mode']; | |
$button_text = $mode == 'view' ? __( 'Update Entry', 'gravityforms' ) : __( 'Update Entry', 'gravityforms' ); | |
$disabled = $mode == 'view' ? '' : ' disabled="disabled" '; | |
$update_button_id = $mode == 'view' ? 'gform_edit_button' : 'gform_update_button'; | |
$button_click = $mode == 'view' ? "jQuery('#screen_mode').val('edit');" : "jQuery('#action').val('update'); jQuery('#screen_mode').val('view');"; | |
$update_button = '<input id="' . $update_button_id . '" ' . $disabled . ' class="button button-large button-primary my-custom-button-class" type="submit" tabindex="4" value="' . esc_attr( $button_text ) . '" name="save" onclick="' . $button_click . '"/>'; | |
return $update_button; | |
} | |
add_action('gform_entrydetail_update_button', 'modifygform_entrydetail_update_button'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment