Skip to content

Commit

Permalink
gfcc-add-in-use-menu-indicator.php: Added new snippet.
Browse files Browse the repository at this point in the history
  • Loading branch information
spivurno authored Jan 30, 2025
1 parent 57a8e61 commit 390de33
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions gf-code-chest/gfcc-add-in-use-menu-indicator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
/**
* Gravity Forms // Code Chest // Display Indicator on Menu Item if Code Chest Has Code
* https://gravitywiz.com/gravity-forms-code-chest/
*/
add_filter( 'gform_form_settings_menu', function( $menu_items, $form_id ) {

$form = GFAPI::get_form( $form_id );

// Check if there is code in the JS or CSS settings using Code Chest methods
$has_js_code = ! empty( gwiz_gf_code_chest()->get_custom_js( $form ) );

Check failure on line 11 in gf-code-chest/gfcc-add-in-use-menu-indicator.php

View workflow job for this annotation

GitHub Actions / PHPCS

Tabs must be used to indent lines; spaces are not allowed

Check warning on line 11 in gf-code-chest/gfcc-add-in-use-menu-indicator.php

View workflow job for this annotation

GitHub Actions / PHPCS

Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space
$has_css_code = ! empty( gwiz_gf_code_chest()->get_custom_css( $form ) );

Check failure on line 12 in gf-code-chest/gfcc-add-in-use-menu-indicator.php

View workflow job for this annotation

GitHub Actions / PHPCS

Tabs must be used to indent lines; spaces are not allowed

// If there is code in either setting, append the ✔ symbol to the Code Chest menu item

Check failure on line 14 in gf-code-chest/gfcc-add-in-use-menu-indicator.php

View workflow job for this annotation

GitHub Actions / PHPCS

Tabs must be used to indent lines; spaces are not allowed
if ( $has_js_code || $has_css_code ) {

Check failure on line 15 in gf-code-chest/gfcc-add-in-use-menu-indicator.php

View workflow job for this annotation

GitHub Actions / PHPCS

Tabs must be used to indent lines; spaces are not allowed
foreach ( $menu_items as &$menu_item ) {

Check failure on line 16 in gf-code-chest/gfcc-add-in-use-menu-indicator.php

View workflow job for this annotation

GitHub Actions / PHPCS

Tabs must be used to indent lines; spaces are not allowed
if ( $menu_item['name'] === 'gf-code-chest' ) {

Check failure on line 17 in gf-code-chest/gfcc-add-in-use-menu-indicator.php

View workflow job for this annotation

GitHub Actions / PHPCS

Tabs must be used to indent lines; spaces are not allowed
$menu_item['label'] .= '';
break;
}
}
}

return $menu_items;
}, 16, 2 );

0 comments on commit 390de33

Please sign in to comment.