Make WordPress Core


Ignore:
Timestamp:
02/02/2024 12:59:21 PM (3 years ago)
Author:
gziolo
Message:

Editor: Add allowed_blocks field to block registration and REST API

There is a new block.json field called allowedBlocks, added in Gutenberg in https://github.com/WordPress/gutenberg/pull/58262. This adds support for this new field also on the server.

Props: gziolo, jsnajdr.
Fixes #60403.

File:
1 edited

Legend:

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

    r57493 r57521  
    6868         */
    6969        public $ancestor = null;
     70
     71        /**
     72         * Limits which block types can be inserted as children of this block type.
     73         *
     74         * @since 6.5.0
     75         * @var string[]|null
     76         */
     77        public $allowed_blocks = null;
    7078
    7179        /**
     
    304312         *     @type string[]|null $ancestor                 Setting ancestor makes a block available only inside the specified
    305313         *                                                   block types at any position of the ancestor's block subtree.
     314         *     @type string[]|null $allowed_blocks           Limits which block types can be inserted as children of this block type.
    306315         *     @type string|null   $icon                     Block type icon.
    307316         *     @type string        $description              A detailed block type description.
Note: See TracChangeset for help on using the changeset viewer.