- Timestamp:
- 10/31/2023 12:56:16 PM (13 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-blocks-controller.php
r56547 r57032 1 1 <?php 2 2 /** 3 * Reusable blocks REST API: WP_REST_Blocks_Controller class3 * Synced patterns REST API: WP_REST_Blocks_Controller class 4 4 * 5 5 * @package WordPress … … 10 10 /** 11 11 * 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_block13 * post type.12 * edit, and delete synced patterns (formerly called reusable blocks). 13 * Patterns are stored as posts with the wp_block post type. 14 14 * 15 15 * @since 5.0.0 … … 21 21 22 22 /** 23 * Checks if a blockcan be read.23 * Checks if a pattern can be read. 24 24 * 25 25 * @since 5.0.0 26 26 * 27 27 * @param WP_Post $post Post object that backs the block. 28 * @return bool Whether the blockcan be read.28 * @return bool Whether the pattern can be read. 29 29 */ 30 30 public function check_read_permission( $post ) { … … 51 51 52 52 /* 53 * Remove `title.rendered` and `content.rendered` from the response. It54 * doesn't make sense for a reusable block to have rendered content on its55 * 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. 56 56 */ 57 57 unset( $data['title']['rendered'] ); … … 65 65 66 66 /** 67 * Retrieves the block's schema, conforming to JSON Schema.67 * Retrieves the pattern's schema, conforming to JSON Schema. 68 68 * 69 69 * @since 5.0.0 … … 79 79 80 80 /* 81 * Allow all contexts to access `title.raw` and `content.raw`. Clients always82 * need the raw markup of a reusable block to do anything useful, e.g. parse83 * 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. 84 84 */ 85 85 $schema['properties']['title']['properties']['raw']['context'] = array( 'view', 'edit' ); … … 87 87 88 88 /* 89 * Remove `title.rendered` and `content.rendered` from the schema. It doesn’t90 * make sense for a reusable block to have rendered content on its own, since91 * 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. 92 92 */ 93 93 unset( $schema['properties']['title']['properties']['rendered'] );
Note: See TracChangeset
for help on using the changeset viewer.