File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Gravity Wiz // Gravity Forms // One-click Delete Field in Compact View
4+ * https://gravitywiz.com/
5+ *
6+ * This snippet adds a one-click delete button (no confirmation) to each field when viewing the
7+ * form in compact view.
8+ *
9+ * Instructions:
10+ *
11+ * 1. Install the snippet.
12+ * https://gravitywiz.com/documentation/managing-snippets/#where-do-i-put-snippets
13+ */
14+ add_action ('admin_footer ' , function () {
15+ if ( GFForms::get_page () !== 'form_editor ' ) {
16+ return ;
17+ }
18+ ?>
19+ <style>
20+ .gform-editor--compact .gw-delete-field {
21+ display: block !important;
22+ }
23+ </style>
24+ <script>
25+ jQuery( '.gform-compact-view-overflow-menu' ).each( function() {
26+ var fieldId = jQuery( this )[0].id.split( '_' )[2];
27+ jQuery( this ).before( '<button class="gw-delete-field gform-droplist__item-trigger--info gform-compact-view-overflow-menu__item-delete" onclick="proceedWithDeletion( ' + fieldId + ' )" style="display: none;min-height: auto;background: transparent;box-shadow: none;padding: 0;border-color:transparent;"><span class="gform-icon gform-icon--trash gform-droplist__item-trigger-icon" style="margin-inline-end:0;cursor:pointer;"></span><div class="gform-text gform-text--color-port gform-typography--size-text-sm gform-typography--weight-regular gform-droplist__item-trigger-text" style="display:none;">Delete</div></button>' )
28+ } );
29+ </script>
30+ <?php
31+ } );
You can’t perform that action at this time.
0 commit comments