From 9b2b8cad20cf01bbbb20eae4af13c9c60c54ba8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Zi=C3=83=C2=B3=C3=85=E2=80=9Akowski?= Date: Mon, 22 Jun 2020 12:20:20 +0000 Subject: [PATCH] Editor: Remove default "layout" block attribute from WP_Block_Type::get_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 --- src/wp-includes/class-wp-block-type.php | 15 ++------------- .../rest-block-renderer-controller.php | 19 ------------------- 2 files changed, 2 insertions(+), 32 deletions(-) diff --git a/src/wp-includes/class-wp-block-type.php b/src/wp-includes/class-wp-block-type.php index 7b5a42bc4e..4758e172ba 100644 --- a/src/wp-includes/class-wp-block-type.php +++ b/src/wp-includes/class-wp-block-type.php @@ -276,18 +276,7 @@ class WP_Block_Type { */ 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(); } } diff --git a/tests/phpunit/tests/rest-api/rest-block-renderer-controller.php b/tests/phpunit/tests/rest-api/rest-block-renderer-controller.php index f15c5b13ff..423d4a4947 100644 --- a/tests/phpunit/tests/rest-api/rest-block-renderer-controller.php +++ b/tests/phpunit/tests/rest-api/rest-block-renderer-controller.php @@ -424,25 +424,6 @@ class REST_Block_Renderer_Controller_Test extends WP_Test_REST_Controller_Testca 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. *