mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 09:07:59 +01:00
Docs: Update some reusable block references to synced patterns.
In WordPress 6.3, [https://wordpress.org/documentation/article/reusable-blocks/ 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. Built from https://develop.svn.wordpress.org/trunk@57032 git-svn-id: http://core.svn.wordpress.org/trunk@56543 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
cc0246c154
commit
ac2b1a56d2
@ -659,7 +659,8 @@ function has_blocks( $post = null ) {
|
||||
*
|
||||
* This test optimizes for performance rather than strict accuracy, detecting
|
||||
* whether the block type exists but not validating its structure and not checking
|
||||
* reusable blocks. For strict accuracy, you should use the block parser on post content.
|
||||
* synced patterns (formerly called reusable blocks). For strict accuracy,
|
||||
* you should use the block parser on post content.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Reusable blocks REST API: WP_REST_Blocks_Controller class
|
||||
* Synced patterns REST API: WP_REST_Blocks_Controller class
|
||||
*
|
||||
* @package WordPress
|
||||
* @subpackage REST_API
|
||||
@ -9,8 +9,8 @@
|
||||
|
||||
/**
|
||||
* Controller which provides a REST endpoint for the editor to read, create,
|
||||
* edit and delete reusable blocks. Blocks are stored as posts with the wp_block
|
||||
* post type.
|
||||
* edit, and delete synced patterns (formerly called reusable blocks).
|
||||
* Patterns are stored as posts with the wp_block post type.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
@ -20,12 +20,12 @@
|
||||
class WP_REST_Blocks_Controller extends WP_REST_Posts_Controller {
|
||||
|
||||
/**
|
||||
* Checks if a block can be read.
|
||||
* Checks if a pattern can be read.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param WP_Post $post Post object that backs the block.
|
||||
* @return bool Whether the block can be read.
|
||||
* @return bool Whether the pattern can be read.
|
||||
*/
|
||||
public function check_read_permission( $post ) {
|
||||
// By default the read_post capability is mapped to edit_posts.
|
||||
@ -50,9 +50,9 @@ class WP_REST_Blocks_Controller extends WP_REST_Posts_Controller {
|
||||
$data = parent::filter_response_by_context( $data, $context );
|
||||
|
||||
/*
|
||||
* Remove `title.rendered` and `content.rendered` from the response. It
|
||||
* doesn't make sense for a reusable block to have rendered content on its
|
||||
* own, since rendering a block requires it to be inside a post or a page.
|
||||
* Remove `title.rendered` and `content.rendered` from the response.
|
||||
* It doesn't make sense for a pattern to have rendered content on its own,
|
||||
* since rendering a block requires it to be inside a post or a page.
|
||||
*/
|
||||
unset( $data['title']['rendered'] );
|
||||
unset( $data['content']['rendered'] );
|
||||
@ -64,7 +64,7 @@ class WP_REST_Blocks_Controller extends WP_REST_Posts_Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the block's schema, conforming to JSON Schema.
|
||||
* Retrieves the pattern's schema, conforming to JSON Schema.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
@ -78,17 +78,17 @@ class WP_REST_Blocks_Controller extends WP_REST_Posts_Controller {
|
||||
$schema = parent::get_item_schema();
|
||||
|
||||
/*
|
||||
* Allow all contexts to access `title.raw` and `content.raw`. Clients always
|
||||
* need the raw markup of a reusable block to do anything useful, e.g. parse
|
||||
* it or display it in an editor.
|
||||
* Allow all contexts to access `title.raw` and `content.raw`.
|
||||
* Clients always need the raw markup of a pattern to do anything useful,
|
||||
* e.g. parse it or display it in an editor.
|
||||
*/
|
||||
$schema['properties']['title']['properties']['raw']['context'] = array( 'view', 'edit' );
|
||||
$schema['properties']['content']['properties']['raw']['context'] = array( 'view', 'edit' );
|
||||
|
||||
/*
|
||||
* Remove `title.rendered` and `content.rendered` from the schema. It doesn’t
|
||||
* make sense for a reusable block to have rendered content on its own, since
|
||||
* rendering a block requires it to be inside a post or a page.
|
||||
* Remove `title.rendered` and `content.rendered` from the schema.
|
||||
* It doesn't make sense for a pattern to have rendered content on its own,
|
||||
* since rendering a block requires it to be inside a post or a page.
|
||||
*/
|
||||
unset( $schema['properties']['title']['properties']['rendered'] );
|
||||
unset( $schema['properties']['content']['properties']['rendered'] );
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.5-alpha-57029';
|
||||
$wp_version = '6.5-alpha-57032';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user