Skip to content

Commit 390de33

Browse files
authored
gfcc-add-in-use-menu-indicator.php: Added new snippet.
1 parent 57a8e61 commit 390de33

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
/**
3+
* Gravity Forms // Code Chest // Display Indicator on Menu Item if Code Chest Has Code
4+
* https://gravitywiz.com/gravity-forms-code-chest/
5+
*/
6+
add_filter( 'gform_form_settings_menu', function( $menu_items, $form_id ) {
7+
8+
$form = GFAPI::get_form( $form_id );
9+
10+
// Check if there is code in the JS or CSS settings using Code Chest methods
11+
$has_js_code = ! empty( gwiz_gf_code_chest()->get_custom_js( $form ) );
12+
$has_css_code = ! empty( gwiz_gf_code_chest()->get_custom_css( $form ) );
13+
14+
// If there is code in either setting, append the ✔ symbol to the Code Chest menu item
15+
if ( $has_js_code || $has_css_code ) {
16+
foreach ( $menu_items as &$menu_item ) {
17+
if ( $menu_item['name'] === 'gf-code-chest' ) {
18+
$menu_item['label'] .= '';
19+
break;
20+
}
21+
}
22+
}
23+
24+
return $menu_items;
25+
}, 16, 2 );

0 commit comments

Comments
 (0)