Skip to content

Commit

Permalink
Editor: Remove default "layout" block attribute from WP_Block_Type::g…
Browse files Browse the repository at this point in the history
…et_attributes

The merging behavior which assigns the `layout` attribute in `WP_Block_Type` gets removed.

Props aduth, TimothyBlynJacobs.
Fixes #50257.



git-svn-id: https://develop.svn.wordpress.org/trunk@48118 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
gziolo authored and donmhico committed Jun 26, 2020
1 parent aa64dea commit 0957231
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 32 deletions.
15 changes: 2 additions & 13 deletions src/wp-includes/class-wp-block-type.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,18 +276,7 @@ public function set_props( $args ) {
*/
public function get_attributes() {
return is_array( $this->attributes ) ?
array_merge(
$this->attributes,
array(
'layout' => array(
'type' => 'string',
),
)
) :
array(
'layout' => array(
'type' => 'string',
),
);
$this->attributes :
array();
}
}
19 changes: 0 additions & 19 deletions tests/phpunit/tests/rest-api/rest-block-renderer-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,25 +424,6 @@ public function test_get_item_with_pre_render_block_filter() {
remove_filter( 'pre_render_block', $pre_render_filter );
}

/**
* Check success response for getting item with layout attribute provided.
*
* @ticket 45098
*/
public function test_get_item_with_layout() {
wp_set_current_user( self::$user_id );

$attributes = array(
'layout' => 'foo',
);

$request = new WP_REST_Request( 'GET', self::$rest_api_route . self::$block_name );
$request->set_param( 'context', 'edit' );
$request->set_param( 'attributes', $attributes );
$response = rest_get_server()->dispatch( $request );
$this->assertEquals( 200, $response->get_status() );
}

/**
* Test getting item with post context.
*
Expand Down

0 comments on commit 0957231

Please sign in to comment.