From 0ea4aeeb58873119ae20784449f08ade54fd13c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Maneiro?= <583546+oandregal@users.noreply.github.com> Date: Thu, 5 Nov 2026 16:58:28 +0100 Subject: [PATCH 1/2] Editor: Summarize the `date` panel of the post form with `publish_date`. The post form's `date` panel is now summarized by the `publish_date` field, which reads "Immediately" while the post has no date of its own, as the post summary did before it moved to the form. Post types providing their own form are unchanged. See #65981. Co-Authored-By: Claude Opus 5.5 --- src/wp-includes/view-config.php | 9 +++++- tests/phpunit/tests/view-config.php | 50 +++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/view-config.php b/src/wp-includes/view-config.php index f0448d976433c..fbecaf47eebb7 100644 --- a/src/wp-includes/view-config.php +++ b/src/wp-includes/view-config.php @@ -46,6 +46,7 @@ function wp_get_entity_view_config_hook_name( $kind, $name ) { * * @since 7.1.0 * @since 7.2.0 Shows a placeholder for an empty excerpt and a missing author. + * @since 7.2.0 Summarizes the `date` panel with the `publish_date` field. * * @return array The default form configuration. */ @@ -95,7 +96,13 @@ function _wp_get_default_posttype_form() { 'sticky', ), ), - 'date', + array( + 'id' => 'date', + 'layout' => array( + 'type' => 'panel', + 'summary' => 'publish_date', + ), + ), 'slug', array( 'id' => 'author', diff --git a/tests/phpunit/tests/view-config.php b/tests/phpunit/tests/view-config.php index 745fbbaab6821..5ce2f9d137b92 100644 --- a/tests/phpunit/tests/view-config.php +++ b/tests/phpunit/tests/view-config.php @@ -139,6 +139,56 @@ public static function data_default_form_post_types() { ); } + /** + * The `date` panel of the default form is summarized by the + * `publish_date` field, which reads "Immediately" while the post has no + * date of its own. + * + * @ticket 65981 + * + * @covers ::_wp_get_default_posttype_form + * + * @dataProvider data_default_form_post_types + * + * @param string $post_type The post type. + */ + public function test_date_panel_is_summarized_by_publish_date( $post_type ) { + if ( ! post_type_exists( $post_type ) ) { + register_post_type( $post_type ); + } + + $config = wp_get_entity_view_config( 'postType', $post_type ); + + $this->assertSame( + array( + 'type' => 'panel', + 'summary' => 'publish_date', + ), + $this->get_form_field( $config, 'date' )['layout'] + ); + + if ( 'page' !== $post_type && 'post' !== $post_type ) { + unregister_post_type( $post_type ); + } + } + + /** + * Post types with their own form keep their `date` member, if any, as it + * is. + * + * @ticket 65981 + * + * @dataProvider data_post_types_with_own_form + * + * @param string $post_type The post type. + */ + public function test_own_form_post_types_do_not_get_date_summary( $post_type ) { + $config = wp_get_entity_view_config( 'postType', $post_type ); + $date = $this->get_form_field( $config, 'date' ); + + $this->assertTrue( null === $date || ! isset( $date['layout']['summary'] ) ); + } + /** * Post types with their own form do not receive the default form groups. * From 2a07a01499b4e314e0ecf88b56dfa6ad3dd76413 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Maneiro?= <583546+oandregal@users.noreply.github.com> Date: Fri, 6 Nov 2026 17:24:23 +0100 Subject: [PATCH 2/2] Editor: Address review feedback on the `date` panel summary. Combines the two `@since 7.2.0` entries of `_wp_get_default_posttype_form()` and asserts the missing `date` summary with `assertFalse( isset() )` and a failure message. Co-Authored-By: Claude Opus 5.5 --- src/wp-includes/view-config.php | 4 ++-- tests/phpunit/tests/view-config.php | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/view-config.php b/src/wp-includes/view-config.php index fbecaf47eebb7..fa7b4f852877a 100644 --- a/src/wp-includes/view-config.php +++ b/src/wp-includes/view-config.php @@ -45,8 +45,8 @@ function wp_get_entity_view_config_hook_name( $kind, $name ) { * returns `false`. * * @since 7.1.0 - * @since 7.2.0 Shows a placeholder for an empty excerpt and a missing author. - * @since 7.2.0 Summarizes the `date` panel with the `publish_date` field. + * @since 7.2.0 Shows a placeholder for an empty excerpt and a missing author, + * and summarizes the `date` panel with the `publish_date` field. * * @return array The default form configuration. */ diff --git a/tests/phpunit/tests/view-config.php b/tests/phpunit/tests/view-config.php index 5ce2f9d137b92..84e6fb113de2c 100644 --- a/tests/phpunit/tests/view-config.php +++ b/tests/phpunit/tests/view-config.php @@ -186,7 +186,10 @@ public function test_own_form_post_types_do_not_get_date_summary( $post_type ) { $config = wp_get_entity_view_config( 'postType', $post_type ); $date = $this->get_form_field( $config, 'date' ); - $this->assertTrue( null === $date || ! isset( $date['layout']['summary'] ) ); + $this->assertFalse( + isset( $date['layout']['summary'] ), + "The `date` member of the $post_type form should not have a summary." + ); } /**