Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gravity Perks // GP Nested Forms // Change Submit Button Text when Editing
<?php
/**
* Gravity Perks // GP Nested Forms // Change Submit Button Text when Editing
* http://gravitywiz.com/documentation/gravity-forms-nested-forms/
*/
add_filter( 'gform_pre_render_2030', function( $form ) {
if( is_callable( 'gp_nested_forms' ) && gp_nested_forms()->get_posted_entry_id() ) {
$parent_form = GFAPI::get_form( gp_nested_forms()->get_parent_form_id() );
/**
* @var GP_Field_Nested_Form $nested_form_field
*/
$nested_form_field = GFAPI::get_field( $parent_form, gp_nested_forms()->get_posted_nested_form_field_id() );
$form['button']['text'] = sprintf( 'Edit %s', $nested_form_field->get_item_label() );
}
return $form;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.