Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions gp-entry-blocks/gpeb-remove-fields-on-edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@
if ( strpos( $field->cssClass, 'gpeb-remove-on-edit' ) !== false ) {
$field->visibility = 'administrative';
}

// For pages, we add conditional logic if its marked for removal.
if ( $field->type == 'page' && strpos( $field->cssClass, 'gpeb-remove-on-edit' ) !== false ) {
$field->conditionalLogic = array(
'actionType' => 'show',
'logicType' => 'all',
'rules' => array(
array(
'fieldId' => 9999, // A dummy field ID that will never match.
'operator' => 'is',
'value' => 'hide'

Check failure on line 44 in gp-entry-blocks/gpeb-remove-fields-on-edit.php

View workflow job for this annotation

GitHub Actions / PHPCS (Files Changed)

Each array item in a multi-line array declaration must end in a comma
)

Check failure on line 45 in gp-entry-blocks/gpeb-remove-fields-on-edit.php

View workflow job for this annotation

GitHub Actions / PHPCS (Files Changed)

Each array item in a multi-line array declaration must end in a comma
)

Check failure on line 46 in gp-entry-blocks/gpeb-remove-fields-on-edit.php

View workflow job for this annotation

GitHub Actions / PHPCS (Files Changed)

Each array item in a multi-line array declaration must end in a comma
Comment on lines +44 to +46
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix trailing commas to satisfy PHPCS and unblock the pipeline

PHPCS is failing with "Each array item in a multi-line array declaration must end in a comma" for these lines. Add trailing commas after the last items in the nested arrays.

Apply this diff:

-						'value'    => 'hide'
-					)
-				)
+						'value'    => 'hide',
+					),
+				),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
'value' => 'hide'
)
)
'value' => 'hide',
),
),
🧰 Tools
🪛 GitHub Check: PHPCS (Files Changed)

[failure] 46-46:
Each array item in a multi-line array declaration must end in a comma


[failure] 45-45:
Each array item in a multi-line array declaration must end in a comma


[failure] 44-44:
Each array item in a multi-line array declaration must end in a comma

🪛 GitHub Actions: PHP Lint (PR)

[error] 44-44: PHPCS error: WordPress.Arrays.CommaAfterArrayItem.NoComma - Each array item in a multi-line array declaration must end in a comma.

🤖 Prompt for AI Agents
In gp-entry-blocks/gpeb-remove-fields-on-edit.php around lines 44 to 46 the
multi-line array items are missing trailing commas which fails PHPCS; add
trailing commas after the last items in the nested arrays (e.g., after 'hide'
and after the closing parent array entries) so each multi-line array element
ends with a comma and the PHPCS rule is satisfied.

);
}
}

return $form;
Expand Down
Loading