Changeset 52051
- Timestamp:
- 11/08/2021 08:58:56 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api.php
r51973 r52051 300 300 // Block Types. 301 301 $controller = new WP_REST_Block_Types_Controller(); 302 $controller->register_routes(); 303 304 // Global Styles. 305 $controller = new WP_REST_Global_Styles_Controller; 302 306 $controller->register_routes(); 303 307 -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php
r52017 r52051 317 317 $response->add_links( $this->prepare_links( $theme ) ); 318 318 319 if ( $theme->get_stylesheet() === wp_get_theme()->get_stylesheet() ) { 320 // This creates a record for the current theme if not existent. 321 $id = WP_Theme_JSON_Resolver::get_user_custom_post_type_id(); 322 } else { 323 $wp_query_args = array( 324 'post_status' => 'publish', 325 'post_type' => 'wp_global_styles', 326 'posts_per_page' => 1, 327 'no_found_rows' => true, 328 'fields' => 'ids', 329 'tax_query' => array( 330 array( 331 'taxonomy' => 'wp_theme', 332 'field' => 'name', 333 'terms' => $theme->get_stylesheet(), 334 ), 335 ), 336 ); 337 $global_styles_query = new WP_Query( $wp_query_args ); 338 $id = ! empty( $global_styles_query->posts ) ? array_shift( $global_styles_query->posts ) : null; 339 } 340 341 if ( $id ) { 342 $response->add_link( 343 'https://api.w.org/user-global-styles', 344 rest_url( 'wp/v2/global-styles/' . $id ) 345 ); 346 } 347 319 348 /** 320 349 * Filters theme data returned from the REST API. -
trunk/src/wp-settings.php
r52049 r52051 255 255 require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-posts-controller.php'; 256 256 require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-attachments-controller.php'; 257 require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-global-styles-controller.php'; 257 258 require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-post-types-controller.php'; 258 259 require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-post-statuses-controller.php'; -
trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php
r52017 r52051 125 125 '/wp/v2/comments', 126 126 '/wp/v2/comments/(?P<id>[\\d]+)', 127 '/wp/v2/global-styles/(?P<id>[\/\w-]+)', 128 '/wp/v2/global-styles/themes/(?P<stylesheet>[^.\/]+(?:\/[^.\/]+)?)', 127 129 '/wp/v2/search', 128 130 '/wp/v2/block-renderer/(?P<name>[a-z0-9-]+/[a-z0-9-]+)', -
trunk/tests/qunit/fixtures/wp-api-generated.js
r52017 r52051 6561 6561 ] 6562 6562 }, 6563 "/wp/v2/global-styles/themes/(?P<stylesheet>[^.\\/]+(?:\\/[^.\\/]+)?)": { 6564 "namespace": "wp/v2", 6565 "methods": [ 6566 "GET" 6567 ], 6568 "endpoints": [ 6569 { 6570 "methods": [ 6571 "GET" 6572 ], 6573 "args": { 6574 "stylesheet": { 6575 "description": "The theme identifier", 6576 "type": "string", 6577 "required": false 6578 } 6579 } 6580 } 6581 ] 6582 }, 6583 "/wp/v2/global-styles/(?P<id>[\\/\\w-]+)": { 6584 "namespace": "wp/v2", 6585 "methods": [ 6586 "GET", 6587 "POST", 6588 "PUT", 6589 "PATCH" 6590 ], 6591 "endpoints": [ 6592 { 6593 "methods": [ 6594 "GET" 6595 ], 6596 "args": { 6597 "id": { 6598 "description": "The id of a template", 6599 "type": "string", 6600 "required": false 6601 } 6602 } 6603 }, 6604 { 6605 "methods": [ 6606 "POST", 6607 "PUT", 6608 "PATCH" 6609 ], 6610 "args": { 6611 "styles": { 6612 "description": "Global styles.", 6613 "type": [ 6614 "object" 6615 ], 6616 "required": false 6617 }, 6618 "settings": { 6619 "description": "Global settings.", 6620 "type": [ 6621 "object" 6622 ], 6623 "required": false 6624 }, 6625 "title": { 6626 "description": "Title of the global styles variation.", 6627 "type": [ 6628 "object", 6629 "string" 6630 ], 6631 "properties": { 6632 "raw": { 6633 "description": "Title for the global styles variation, as it exists in the database.", 6634 "type": "string", 6635 "context": [ 6636 "view", 6637 "edit", 6638 "embed" 6639 ] 6640 }, 6641 "rendered": { 6642 "description": "HTML title for the post, transformed for display.", 6643 "type": "string", 6644 "context": [ 6645 "view", 6646 "edit", 6647 "embed" 6648 ], 6649 "readonly": true 6650 } 6651 }, 6652 "required": false 6653 } 6654 } 6655 } 6656 ] 6657 }, 6563 6658 "/wp/v2/settings": { 6564 6659 "namespace": "wp/v2",
Note: See TracChangeset
for help on using the changeset viewer.