Skip to content
Open
Show file tree
Hide file tree
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
28 changes: 28 additions & 0 deletions src/wp-includes/view-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Make sure to update from the GB PR here.

'id' => 'sync-status',
'layout' => array(
'type' => 'regular',
'labelPosition' => 'side',
),
),
'revisions',
),
);

return $config;
}

Expand Down
46 changes: 46 additions & 0 deletions tests/phpunit/tests/rest-api/rest-view-config-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this test pertinent?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It was removed from the GB PR and will not be added here.

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 ([]).
*
Expand Down
Loading