Changeset 56160
- Timestamp:
- 07/07/2023 07:27:53 AM (19 months ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r56120 r56160 8042 8042 * Registers any additional post meta fields. 8043 8043 * 8044 * @since 6.3.0 Adds sync_statusmeta field to the wp_block post type so an unsynced option can be added.8044 * @since 6.3.0 Adds `wp_pattern_sync_status` meta field to the wp_block post type so an unsynced option can be added. 8045 8045 * 8046 8046 * @link https://github.com/WordPress/gutenberg/pull/51144 … … 8049 8049 register_post_meta( 8050 8050 'wp_block', 8051 ' sync_status',8051 'wp_pattern_sync_status', 8052 8052 array( 8053 8053 'sanitize_callback' => 'sanitize_text_field', -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-blocks-controller.php
r56093 r56160 41 41 * 42 42 * @since 5.0.0 43 * @since 6.3 Adds the `wp_pattern_sync_status` postmeta property to the top level of response. 43 44 * 44 45 * @param array $data Response data to filter. … … 57 58 unset( $data['content']['rendered'] ); 58 59 60 // Add the core wp_pattern_sync_status meta as top level property to the response. 61 $data['wp_pattern_sync_status'] = isset( $data['meta']['wp_pattern_sync_status'] ) ? $data['meta']['wp_pattern_sync_status'] : ''; 62 unset( $data['meta']['wp_pattern_sync_status'] ); 59 63 return $data; 60 64 } -
trunk/tests/phpunit/tests/rest-api/rest-blocks-controller.php
r55457 r56160 221 221 ); 222 222 } 223 224 /** 225 * Check that the `wp_pattern_sync_status` postmeta is moved from meta array to top 226 * level of response. 227 * 228 * @ticket 58677 229 */ 230 public function test_wp_patterns_sync_status_post_meta() { 231 register_post_meta( 232 'wp_block', 233 'wp_pattern_sync_status', 234 array( 235 'single' => true, 236 'type' => 'string', 237 'show_in_rest' => array( 238 'schema' => array( 239 'type' => 'string', 240 'properties' => array( 241 'sync_status' => array( 242 'type' => 'string', 243 ), 244 ), 245 ), 246 ), 247 ) 248 ); 249 wp_set_current_user( self::$user_ids['author'] ); 250 251 $request = new WP_REST_Request( 'GET', '/wp/v2/blocks/' . self::$post_id ); 252 $response = rest_get_server()->dispatch( $request ); 253 $data = $response->get_data(); 254 255 $this->assertArrayHasKey( 'wp_pattern_sync_status', $data ); 256 $this->assertArrayNotHasKey( 'wp_pattern_sync_status', $data['meta'] ); 257 } 223 258 }
Note: See TracChangeset
for help on using the changeset viewer.