Skip to content

Commit d3236d4

Browse files
committed
gpeb-remove-fields-on-edit.php: Added logic to remove pages on GPEB edit.
1 parent 58314e5 commit d3236d4

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

gp-entry-blocks/gpeb-remove-fields-on-edit.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,21 @@ function gpeb_remove_fields_on_edit( $form ) {
3131
if ( strpos( $field->cssClass, 'gpeb-remove-on-edit' ) !== false ) {
3232
$field->visibility = 'administrative';
3333
}
34+
35+
// For pages, we add conditional logic if its marked for removal.
36+
if ( $field->type == 'page' && strpos( $field->cssClass, 'gpeb-remove-on-edit' ) !== false ) {
37+
$field->conditionalLogic = array(
38+
'actionType' => 'show',
39+
'logicType' => 'all',
40+
'rules' => array(
41+
array(
42+
'fieldId' => 9999, // A dummy field ID that will never match.
43+
'operator' => 'is',
44+
'value' => 'hide'
45+
)
46+
)
47+
);
48+
}
3449
}
3550

3651
return $form;

0 commit comments

Comments
 (0)