Make WordPress Core


Ignore:
Timestamp:
09/14/2023 01:23:13 PM (17 months ago)
Author:
Bernhard Reiter
Message:

General: Add block_hooks field to block type registration, REST API.

In order to implement Block Hooks, we need to add a new block_hooks field to the WP_Block_Type class, as well as to block registration related functions, the block types REST API controller, etc.

Props gziolo.
Fixes #59346. See #59313.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php

    r56586 r56587  
    292292                'style_handles',
    293293                'variations',
     294                'block_hooks',
    294295            ),
    295296            $deprecated_fields
     
    707708                'keywords'              => $keywords_definition,
    708709                'example'               => $example_definition,
     710                'block_hooks'           => array(
     711                    'description'       => __( 'This block is automatically inserted near any occurence of the block types used as keys of this map, into a relative position given by the corresponding value.' ),
     712                    'type'              => 'object',
     713                    'patternProperties' => array(
     714                        '^[a-zA-Z0-9-]+/[a-zA-Z0-9-]+$' => array(
     715                            'type' => 'string',
     716                            'enum' => array( 'before', 'after', 'first_child', 'last_child' ),
     717                        ),
     718                    ),
     719                    'default'           => array(),
     720                    'context'           => array( 'embed', 'view', 'edit' ),
     721                    'readonly'          => true,
     722                ),
    709723            ),
    710724        );
Note: See TracChangeset for help on using the changeset viewer.