Changeset 58394 for trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php
- Timestamp:
- 06/12/2024 07:15:06 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php
r58262 r58394 232 232 * @since 5.9.0 233 233 * @since 6.2.0 Added validation of styles.css property. 234 * @since 6.6.0 Added registration of newly created style variations provided by the user. 234 235 * 235 236 * @param WP_REST_Request $request Request object. … … 264 265 $config['styles'] = $existing_config['styles']; 265 266 } 267 268 /* 269 * If the incoming request is going to create a new variation 270 * that is not yet registered, we register it here. 271 * This is because the variations are registered on init, 272 * but we want this endpoint to return the new variation immediately: 273 * if we don't register it, it'll be stripped out of the response 274 * just in this request (subsequent ones will be ok). 275 * Take the variations defined in styles.blocks.variations from the incoming request 276 * that are not part of the $exsting_config. 277 */ 278 if ( isset( $request['styles']['blocks']['variations'] ) ) { 279 $existing_variations = isset( $existing_config['styles']['blocks']['variations'] ) ? $existing_config['styles']['blocks']['variations'] : array(); 280 $new_variations = array_diff_key( $request['styles']['blocks']['variations'], $existing_variations ); 281 if ( ! empty( $new_variations ) ) { 282 wp_register_block_style_variations_from_theme_json_data( $new_variations ); 283 } 284 } 285 266 286 if ( isset( $request['settings'] ) ) { 267 287 $config['settings'] = $request['settings'];
Note: See TracChangeset
for help on using the changeset viewer.