Make WordPress Core


Ignore:
Timestamp:
04/21/2023 10:41:58 AM (18 months ago)
Author:
gziolo
Message:

Editor: Add selectors field to block type definition

Adds support for the new selectors property for block types. It adds it to the allowed metadata when registering a block type, makes the WP_Block_Type class aware of it, exposes it through the block types REST API, and the get_block_editor_server_block_settings function.

Corresponding work in the Gutenberg plugin: https://github.com/WordPress/gutenberg/pull/46496.

Fixes #57585.
Props aaronrobertshaw, hellofromTonya.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/blocks/register.php

    r55486 r55673  
    484484     * @ticket 50263
    485485     * @ticket 50328
     486     * @ticket 57585
    486487     */
    487488    public function test_block_registers_with_metadata_fixture() {
     
    516517        );
    517518        $this->assertSameSets( array( 'groupId' ), $result->uses_context );
     519        // @ticket 57585
     520        $this->assertSame(
     521            array( 'root' => '.wp-block-notice' ),
     522            $result->selectors,
     523            'Block type should contain selectors from metadata.'
     524        );
    518525        $this->assertSame(
    519526            array(
Note: See TracChangeset for help on using the changeset viewer.