Created
June 24, 2024 14:36
-
-
Save matty0501/ddb10a7e8da961da68434418c995823f to your computer and use it in GitHub Desktop.
This file contains 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 | |
/** | |
* Gravity Perks // Nested Forms // Add `Required` label to Nested Form field | |
* https://gravitywiz.com/documentation/gravity-forms-nested-forms/ | |
* | |
* Adds a `Required` label to a Nested Form field when a minimum child entry limit is set. | |
*/ | |
// Replace `123` with your form ID and `4` with your Nested Form field ID | |
add_filter( 'gform_field_content_123_4', function ( $content, $field, $value, $lead_id, $form_id ) { | |
if( $field->gpnfEntryLimitMin > 0 ){ | |
$content = str_replace ( $field->label, $field->label. '<span class="gfield_required">' . GFFormsModel::get_required_indicator( $form_id ) . '</span>', $content ); | |
} | |
return $content; | |
}, 10, 5 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment