diff --git a/src/wp-includes/view-config.php b/src/wp-includes/view-config.php index 810fafb840384..fa30f9f3eade7 100644 --- a/src/wp-includes/view-config.php +++ b/src/wp-includes/view-config.php @@ -473,6 +473,34 @@ function _wp_get_entity_view_config_post_type_wp_block( $config ) { $config['view_list'] = $view_list; + $config['form'] = array( + 'layout' => array( 'type' => 'panel' ), + 'fields' => array( + array( + 'id' => 'excerpt', + 'layout' => array( + 'type' => 'panel', + 'labelPosition' => 'top', + ), + ), + array( + 'id' => 'post-content-info', + 'layout' => array( + 'type' => 'regular', + 'labelPosition' => 'none', + ), + ), + array( + 'id' => 'sync-status', + 'layout' => array( + 'type' => 'regular', + 'labelPosition' => 'side', + ), + ), + 'revisions', + ), + ); + return $config; } diff --git a/tests/phpunit/tests/rest-api/rest-view-config-controller.php b/tests/phpunit/tests/rest-api/rest-view-config-controller.php index b487055ff14d8..fe3bfb1afa11b 100644 --- a/tests/phpunit/tests/rest-api/rest-view-config-controller.php +++ b/tests/phpunit/tests/rest-api/rest-view-config-controller.php @@ -301,6 +301,52 @@ public function test_get_items_matches_underlying_config() { $this->assertSame( $config['form'], $data['form'] ); } + /** + * The pattern form config exposes the fields shown in the pattern summary. + * + * @ticket 65516 + * + * @covers WP_REST_View_Config_Controller::get_items + */ + public function test_wp_block_config_includes_pattern_summary_form() { + wp_set_current_user( self::$editor_id ); + + $response = $this->dispatch_request( 'postType', 'wp_block' ); + $data = $response->get_data(); + + $this->assertSame( 200, $response->get_status() ); + $this->assertSame( + array( + 'layout' => array( 'type' => 'panel' ), + 'fields' => array( + array( + 'id' => 'excerpt', + 'layout' => array( + 'type' => 'panel', + 'labelPosition' => 'top', + ), + ), + array( + 'id' => 'post-content-info', + 'layout' => array( + 'type' => 'regular', + 'labelPosition' => 'none', + ), + ), + array( + 'id' => 'sync-status', + 'layout' => array( + 'type' => 'regular', + 'labelPosition' => 'side', + ), + ), + 'revisions', + ), + ), + $data['form'] + ); + } + /** * Empty object-typed config values serialize as JSON objects ({}), not arrays ([]). *