Make WordPress Core


Ignore:
Timestamp:
04/26/2022 09:48:20 AM (3 years ago)
Author:
gziolo
Message:

Editor: Register 'lock' attribute for every block on the server

Backports changes from https://github.com/WordPress/gutenberg/pull/40468.

The lock attribute needs to be supported by every block, but currently, it is only done on the client site. As a result, it was causing block rendered API requests to fail when blocks are locked.

Props mamaduka, peterwilsoncc.
See #55567.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-block-type-controller.php

    r53084 r53268  
    244244        $this->assertNull( $data['style'] );
    245245        $this->assertSameSets( array(), $data['provides_context'] );
    246         $this->assertSameSets( array(), $data['attributes'] );
     246        $this->assertSameSetsWithIndex(
     247            array(
     248                'lock' => array( 'type' => 'object' ),
     249            ),
     250            $data['attributes']
     251        );
    247252        $this->assertSameSets( array( 'invalid_uses_context' ), $data['uses_context'] );
    248253        $this->assertSameSets( array( 'invalid_keywords' ), $data['keywords'] );
     
    300305        $this->assertNull( $data['editor_style'] );
    301306        $this->assertNull( $data['style'] );
    302         $this->assertSameSets( array(), $data['attributes'] );
     307        $this->assertSameSetsWithIndex(
     308            array(
     309                'lock' => array( 'type' => 'object' ),
     310            ),
     311            $data['attributes']
     312        );
    303313        $this->assertSameSets( array(), $data['provides_context'] );
    304314        $this->assertSameSets( array(), $data['uses_context'] );
Note: See TracChangeset for help on using the changeset viewer.