Make WordPress Core

Changeset 57032 for trunk


Ignore:
Timestamp:
10/31/2023 12:56:16 PM (13 months ago)
Author:
SergeyBiryukov
Message:

Docs: Update some reusable block references to synced patterns.

In WordPress 6.3, Reusable Blocks were renamed to Patterns. A synced pattern will behave in exactly the same way as a reusable block.

This commit updates some references in DocBlocks and inline comments to use the new name.

Follow-up to [56030].

Props benjaminknox, oglekler, hellofromTonya, marybaum, nicolefurlan.
Fixes #59388.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks.php

    r57026 r57032  
    660660 * This test optimizes for performance rather than strict accuracy, detecting
    661661 * whether the block type exists but not validating its structure and not checking
    662  * reusable blocks. For strict accuracy, you should use the block parser on post content.
     662 * synced patterns (formerly called reusable blocks). For strict accuracy,
     663 * you should use the block parser on post content.
    663664 *
    664665 * @since 5.0.0
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-blocks-controller.php

    r56547 r57032  
    11<?php
    22/**
    3  * Reusable blocks REST API: WP_REST_Blocks_Controller class
     3 * Synced patterns REST API: WP_REST_Blocks_Controller class
    44 *
    55 * @package WordPress
     
    1010/**
    1111 * Controller which provides a REST endpoint for the editor to read, create,
    12  * edit and delete reusable blocks. Blocks are stored as posts with the wp_block
    13  * post type.
     12 * edit, and delete synced patterns (formerly called reusable blocks).
     13 * Patterns are stored as posts with the wp_block post type.
    1414 *
    1515 * @since 5.0.0
     
    2121
    2222    /**
    23      * Checks if a block can be read.
     23     * Checks if a pattern can be read.
    2424     *
    2525     * @since 5.0.0
    2626     *
    2727     * @param WP_Post $post Post object that backs the block.
    28      * @return bool Whether the block can be read.
     28     * @return bool Whether the pattern can be read.
    2929     */
    3030    public function check_read_permission( $post ) {
     
    5151
    5252        /*
    53          * Remove `title.rendered` and `content.rendered` from the response. It
    54          * doesn't make sense for a reusable block to have rendered content on its
    55          * own, since rendering a block requires it to be inside a post or a page.
     53         * Remove `title.rendered` and `content.rendered` from the response.
     54         * It doesn't make sense for a pattern to have rendered content on its own,
     55         * since rendering a block requires it to be inside a post or a page.
    5656         */
    5757        unset( $data['title']['rendered'] );
     
    6565
    6666    /**
    67      * Retrieves the block's schema, conforming to JSON Schema.
     67     * Retrieves the pattern's schema, conforming to JSON Schema.
    6868     *
    6969     * @since 5.0.0
     
    7979
    8080        /*
    81          * Allow all contexts to access `title.raw` and `content.raw`. Clients always
    82          * need the raw markup of a reusable block to do anything useful, e.g. parse
    83          * it or display it in an editor.
     81         * Allow all contexts to access `title.raw` and `content.raw`.
     82         * Clients always need the raw markup of a pattern to do anything useful,
     83         * e.g. parse it or display it in an editor.
    8484         */
    8585        $schema['properties']['title']['properties']['raw']['context']   = array( 'view', 'edit' );
     
    8787
    8888        /*
    89          * Remove `title.rendered` and `content.rendered` from the schema. It doesn’t
    90          * make sense for a reusable block to have rendered content on its own, since
    91          * rendering a block requires it to be inside a post or a page.
     89         * Remove `title.rendered` and `content.rendered` from the schema.
     90         * It doesn't make sense for a pattern to have rendered content on its own,
     91         * since rendering a block requires it to be inside a post or a page.
    9292         */
    9393        unset( $schema['properties']['title']['properties']['rendered'] );
  • trunk/tests/phpunit/tests/blocks/renderReusable.php

    r55457 r57032  
    11<?php
    22/**
    3  * Tests for reusable block rendering.
     3 * Tests for synced pattern rendering.
    44 *
    55 * @package WordPress
     
    8484
    8585    /**
    86      * Make sure that a reusable block can be rendered twice in a row.
     86     * Make sure that a synced pattern can be rendered twice in a row.
    8787     *
    8888     * @ticket 52364
  • trunk/tests/phpunit/tests/rest-api/rest-blocks-controller.php

    r56160 r57032  
    9999    /**
    100100     * Exhaustively check that each role either can or cannot create, edit,
    101      * update, and delete reusable blocks.
     101     * update, and delete synced patterns.
    102102     *
    103103     * @ticket 45098
Note: See TracChangeset for help on using the changeset viewer.