File tree Expand file tree Collapse file tree 1 file changed +3
-18
lines changed Expand file tree Collapse file tree 1 file changed +3
-18
lines changed Original file line number Diff line number Diff line change 11<?php
22/**
3- * Gravity Perks // Entry Blocks // Hide Specific Fields on Edit
4- * https://gravitywiz.com/documentation/gravity-forms-entry-blocks/
3+ * This snippet has evolved! 🦄
4+ * Find the latest version of this snippet here:
5+ * https://github.com/gravitywiz/snippet-library/blob/master/gp-entry-blocks/gpeb-remove-fields-on-edit.php
56 */
6- // Update "123" to your form ID.
7- add_filter ( 'gform_pre_render_123 ' , function ( $ form ) {
8- // Update "4", "5", and "6" to the IDs of the fields you'd like to hide.
9- $ fields_to_hide = array ( 4 , 5 , 6 );
10- if ( ! class_exists ( 'WP_Block_Supports ' ) || rgar ( WP_Block_Supports::$ block_to_render , 'blockName ' ) !== 'gp-entry-blocks/edit-form ' ) {
11- return $ form ;
12- }
13- $ filtered_fields = array ();
14- foreach ( $ form ['fields ' ] as &$ field ) {
15- if ( ! in_array ( $ field ->id , $ fields_to_hide ) ) {
16- $ filtered_fields [] = $ field ;
17- }
18- }
19- $ form ['fields ' ] = $ filtered_fields ;
20- return $ form ;
21- } );
You can’t perform that action at this time.
0 commit comments