Skip to content

Commit 618d494

Browse files
authored
gpmpn-dropdown-navigation.js: Added page names in dropdown navigation.
1 parent 8ebecf6 commit 618d494

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

gp-multi-page-navigation/gpmpn-dropdown-navigation.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* This snippet is designed to be used with the Gravity Forms Code Chest plugin.
88
* https://gravitywiz.com/gravity-forms-code-chest/
99
*/
10+
const pageNameTemplate = 'Step {pageNumber}: {pageName}';
1011
function updateNavigationState( ) {
1112
// hide if visible
1213
$( '#gf_page_steps_GFFORMID' ).attr( 'hidden', 'true' );
@@ -33,10 +34,15 @@ function updateNavigationState( ) {
3334
}
3435

3536
$( '#gf_page_steps_GFFORMID .gf_step' ).each( function( ) {
36-
var $div = $( this );
37+
var $div = $( this );
3738
var stepNumber = $div.find('.gf_step_number').text();
38-
var $a = $div.find('a');
39-
var $option = $('<option></option>').text( 'Step ' + stepNumber );
39+
var pageName = $div.find('.gf_step_label').text().trim();
40+
var optionText = pageNameTemplate
41+
.replace('{pageNumber}', stepNumber)
42+
.replace('{pageName}', pageName);
43+
44+
var $a = $div.find('a');
45+
var $option = $('<option></option>').text( optionText );
4046

4147
if ( $a.length > 0 ) {
4248
// found a tag, add the link to the dropdown option

0 commit comments

Comments
 (0)