Skip to content

Commit 3f62f26

Browse files
authored
gpeb-hide-specific-fields-on-edit.php: Deprecated.
1 parent 0161d8d commit 3f62f26

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed
Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,6 @@
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-
} );

0 commit comments

Comments
 (0)