Skip to content

View Config: Make the panel summary of the default form groups explicit - #13308

Open
oandregal wants to merge 1 commit into
WordPress:trunkfrom
oandregal:fix/view-config-group-summaries
Open

View Config: Make the panel summary of the default form groups explicit#13308
oandregal wants to merge 1 commit into
WordPress:trunkfrom
oandregal:fix/view-config-group-summaries

Conversation

@oandregal

Copy link
Copy Markdown
Member

The status and discussion groups of the default post type form used to be summarized by the field sharing their id (status, and the composite discussion field from @wordpress/fields). A combined form field no longer resolves its own id against the field definitions, so the summary field is declared through layout.summary instead. Without it, the groups would be summarized by their first child (status is unchanged, but discussion would show comment_status alone).

Gutenberg PR: WordPress/gutenberg#82175
Trac ticket: https://core.trac.wordpress.org/ticket/65981

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Fable
Used for: Porting the server-side change and its unit test from the Gutenberg PR. Reviewed and edited by me.

The `status` and `discussion` groups of the default post type form used
to be summarized by the field sharing their id (`status`, and the
composite `discussion` field). A combined form field no longer resolves
its own id against the field definitions, so the summary field is
declared through `layout.summary` instead.

Backports WordPress/gutenberg#82175.

See #65981.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 28, 2026 14:42
@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props oandregal.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the default post type entity view config form so the status and discussion field groups explicitly declare their panel summary via layout.summary, aligning core’s server-provided configuration with the updated summary-resolution behavior for composite/group fields.

Changes:

  • Add explicit layout (type: panel, summary: <group-id>) for the status and discussion groups in _wp_get_default_posttype_form().
  • Add a PHPUnit test to assert that these groups exist, retain children, and declare an explicit summary for built-in and custom post types.
  • Introduce a small test helper for retrieving a form field by id from a config.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/wp-includes/view-config.php Makes status and discussion groups declare layout.summary explicitly in the default post type form config.
tests/phpunit/tests/view-config.php Adds coverage to ensure the default post type form groups explicitly declare their summary for core and custom post types.
Suppressed comments (1)

tests/phpunit/tests/view-config.php:121

  • The test indexes $field['children'] and $field['layout'] directly. If either key is missing (which is exactly what this test is meant to detect), PHP notices can occur before assertions run, making the failure less clear. Add assertArrayHasKey() checks and assert only the relevant layout properties so the test stays robust if additional optional layout keys are added later.
			$this->assertNotNull( $field, "The `{$group}` group is present." );
			$this->assertNotEmpty( $field['children'], "The `{$group}` group keeps its children." );
			$this->assertSame(
				array(
					'type'    => 'panel',
					'summary' => $group,
				),
				$field['layout'],
				"The `{$group}` group summary is explicit."
			);

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +84 to +91
private function get_form_field( $config, $id ) {
foreach ( $config['form']['fields'] as $field ) {
if ( is_array( $field ) && isset( $field['id'] ) && $id === $field['id'] ) {
return $field;
}
}
return null;
}
@oandregal oandregal self-assigned this Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants