Changeset 58429 for trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php
- Timestamp:
- 06/18/2024 07:07:52 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
r58394 r58429 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 * @since 6.6.0 Added registration of block style variations from theme.json sources (theme.json, user theme.json, partials). 235 235 * 236 236 * @param WP_REST_Request $request Request object. … … 266 266 } 267 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 } 268 // Register theme-defined variations. 269 WP_Theme_JSON_Resolver::get_theme_data(); 270 271 // Register user-defined variations. 272 if ( ! empty( $config['styles']['blocks']['variations'] ) ) { 273 wp_register_block_style_variations_from_theme_json_data( $config['styles']['blocks']['variations'] ); 284 274 } 285 275
Note:
See TracChangeset
for help on using the changeset viewer.