WordPress.org

Make WordPress Core

Changeset 48118


Ignore:
Timestamp:
06/22/2020 12:20:20 PM (18 months ago)
Author:
gziolo
Message:

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.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-block-type.php

    r48117 r48118  
    277277    public function get_attributes() {
    278278        return is_array( $this->attributes ) ?
    279             array_merge(
    280                 $this->attributes,
    281                 array(
    282                     'layout' => array(
    283                         'type' => 'string',
    284                     ),
    285                 )
    286             ) :
    287             array(
    288                 'layout' => array(
    289                     'type' => 'string',
    290                 ),
    291             );
     279            $this->attributes :
     280            array();
    292281    }
    293282}
  • trunk/tests/phpunit/tests/rest-api/rest-block-renderer-controller.php

    r48106 r48118  
    426426
    427427    /**
    428      * Check success response for getting item with layout attribute provided.
    429      *
    430      * @ticket 45098
    431      */
    432     public function test_get_item_with_layout() {
    433         wp_set_current_user( self::$user_id );
    434 
    435         $attributes = array(
    436             'layout' => 'foo',
    437         );
    438 
    439         $request = new WP_REST_Request( 'GET', self::$rest_api_route . self::$block_name );
    440         $request->set_param( 'context', 'edit' );
    441         $request->set_param( 'attributes', $attributes );
    442         $response = rest_get_server()->dispatch( $request );
    443         $this->assertEquals( 200, $response->get_status() );
    444     }
    445 
    446     /**
    447428     * Test getting item with post context.
    448429     *
Note: See TracChangeset for help on using the changeset viewer.