Skip to content

Commit d05df5d

Browse files
authored
gpeb-disable-copy-cat-edit.php: Added snippet to disable Copy Cat when editing using Entry Blocks.
1 parent 0997881 commit d05df5d

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
/**
3+
* Gravity Perks // Entry Blocks // Disable Copy Cat When Editing.
4+
* https://gravitywiz.com/documentation/gravity-forms-entry-blocks/
5+
*
6+
* Removes copy cat functionality on Entry Blocks' Edit Page.
7+
*/
8+
add_filter( 'gpeb_edit_form', function ( $form ) {
9+
foreach ( $form['fields'] as &$field ) {
10+
// remove any of the copy cat classes from the field.
11+
preg_match_all( '/copy-([0-9]+(?:.[0-9]+)*)-to-([0-9]+(?:.[0-9]+)*)(?:-if-([0-9]+(?:.[0-9]+)*))?/', $field['cssClass'], $matches, PREG_SET_ORDER );
12+
if ( empty( $matches ) ) {
13+
continue;
14+
}
15+
$field['cssClass'] = str_replace( $matches[0], '', $field['cssClass'] );
16+
}
17+
18+
return $form;
19+
} );

0 commit comments

Comments
 (0)