Changeset 57628
- Timestamp:
- 02/13/2024 03:10:37 PM (12 months ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-post-type.php
r57624 r57628 914 914 * 915 915 * @since 6.4.0 916 * @since 6.5.0 Prevents autosave class instantiation for wp_global_styles post types.917 916 * 918 917 * @return WP_REST_Controller|null The controller instance, or null if the post type … … 924 923 } 925 924 926 if ( in_array( $this->name, array( 'attachment', 'wp_global_styles' ), true )) {925 if ( 'attachment' === $this->name ) { 927 926 return null; 928 927 } -
trunk/src/wp-includes/post.php
r57624 r57628 474 474 'wp_global_styles', 475 475 array( 476 'label' => _x( 'Global Styles', 'post type general name' ), 477 'description' => __( 'Global styles to include in themes.' ), 478 'public' => false, 479 '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ 480 '_edit_link' => '/site-editor.php?canvas=edit', /* internal use only. don't use this when registering your own post type. */ 481 'show_ui' => false, 482 'show_in_rest' => true, 483 'rewrite' => false, 484 'rest_base' => 'global-styles', 485 'rest_controller_class' => 'WP_REST_Global_Styles_Controller', 486 'revisions_rest_controller_class' => 'WP_REST_Global_Styles_Revisions_Controller', 487 'late_route_registration' => true, 488 'capabilities' => array( 476 'label' => _x( 'Global Styles', 'post type general name' ), 477 'description' => __( 'Global styles to include in themes.' ), 478 'public' => false, 479 '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ 480 '_edit_link' => '/site-editor.php?canvas=edit', /* internal use only. don't use this when registering your own post type. */ 481 'show_ui' => false, 482 'show_in_rest' => false, 483 'rewrite' => false, 484 'capabilities' => array( 489 485 'read' => 'edit_theme_options', 490 486 'create_posts' => 'edit_theme_options', … … 495 491 'delete_others_posts' => 'edit_theme_options', 496 492 ), 497 'map_meta_cap' 498 'supports' 493 'map_meta_cap' => true, 494 'supports' => array( 499 495 'title', 500 496 'editor', -
trunk/src/wp-includes/rest-api.php
r57624 r57628 322 322 // Block Types. 323 323 $controller = new WP_REST_Block_Types_Controller(); 324 $controller->register_routes(); 325 326 // Global Styles revisions. 327 $controller = new WP_REST_Global_Styles_Revisions_Controller(); 328 $controller->register_routes(); 329 330 // Global Styles. 331 $controller = new WP_REST_Global_Styles_Controller(); 324 332 $controller->register_routes(); 325 333 -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php
r57624 r57628 11 11 * Base Global Styles REST API Controller. 12 12 */ 13 class WP_REST_Global_Styles_Controller extends WP_REST_Posts_Controller { 14 /** 15 * Whether the controller supports batching. 16 * 17 * @since 6.5.0 18 * @var array 19 */ 20 protected $allow_batch = array( 'v1' => false ); 13 class WP_REST_Global_Styles_Controller extends WP_REST_Controller { 14 15 /** 16 * Post type. 17 * 18 * @since 5.9.0 19 * @var string 20 */ 21 protected $post_type; 22 23 /** 24 * Constructor. 25 * @since 5.9.0 26 */ 27 public function __construct() { 28 $this->namespace = 'wp/v2'; 29 $this->rest_base = 'global-styles'; 30 $this->post_type = 'wp_global_styles'; 31 } 21 32 22 33 /** … … 184 195 * @return bool Whether the post can be read. 185 196 */ 186 p ublicfunction check_read_permission( $post ) {197 protected function check_read_permission( $post ) { 187 198 return current_user_can( 'read_post', $post->ID ); 199 } 200 201 /** 202 * Returns the given global styles config. 203 * 204 * @since 5.9.0 205 * 206 * @param WP_REST_Request $request The request instance. 207 * 208 * @return WP_REST_Response|WP_Error 209 */ 210 public function get_item( $request ) { 211 $post = $this->get_post( $request['id'] ); 212 if ( is_wp_error( $post ) ) { 213 return $post; 214 } 215 216 return $this->prepare_item_for_response( $post, $request ); 188 217 } 189 218 … … 211 240 212 241 return true; 242 } 243 244 /** 245 * Checks if a global style can be edited. 246 * 247 * @since 5.9.0 248 * 249 * @param WP_Post $post Post object. 250 * @return bool Whether the post can be edited. 251 */ 252 protected function check_update_permission( $post ) { 253 return current_user_can( 'edit_post', $post->ID ); 254 } 255 256 /** 257 * Updates a single global style config. 258 * 259 * @since 5.9.0 260 * 261 * @param WP_REST_Request $request Full details about the request. 262 * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. 263 */ 264 public function update_item( $request ) { 265 $post_before = $this->get_post( $request['id'] ); 266 if ( is_wp_error( $post_before ) ) { 267 return $post_before; 268 } 269 270 $changes = $this->prepare_item_for_database( $request ); 271 if ( is_wp_error( $changes ) ) { 272 return $changes; 273 } 274 275 $result = wp_update_post( wp_slash( (array) $changes ), true, false ); 276 if ( is_wp_error( $result ) ) { 277 return $result; 278 } 279 280 $post = get_post( $request['id'] ); 281 $fields_update = $this->update_additional_fields_for_object( $post, $request ); 282 if ( is_wp_error( $fields_update ) ) { 283 return $fields_update; 284 } 285 286 wp_after_insert_post( $post, true, $post_before ); 287 288 $response = $this->prepare_item_for_response( $post, $request ); 289 290 return rest_ensure_response( $response ); 213 291 } 214 292 … … 330 408 $response->add_links( $links ); 331 409 if ( ! empty( $links['self']['href'] ) ) { 332 $actions = $this->get_available_actions( $post, $request);410 $actions = $this->get_available_actions(); 333 411 $self = $links['self']['href']; 334 412 foreach ( $actions as $rel ) { … … 354 432 355 433 $links = array( 356 'self' 434 'self' => array( 357 435 'href' => rest_url( trailingslashit( $base ) . $id ), 358 ),359 'about' => array(360 'href' => rest_url( 'wp/v2/types/' . $this->post_type ),361 436 ), 362 437 ); … … 380 455 * @since 5.9.0 381 456 * @since 6.2.0 Added 'edit-css' action. 382 * @since 6.5.0 Added $post and $request parameters. 383 * 384 * @param WP_Post $post Post object. 385 * @param WP_REST_Request $request Request object. 457 * 386 458 * @return array List of link relations. 387 459 */ 388 protected function get_available_actions( $post, $request) {460 protected function get_available_actions() { 389 461 $rels = array(); 390 462 391 $post_type = get_post_type_object( $ post->post_type );463 $post_type = get_post_type_object( $this->post_type ); 392 464 if ( current_user_can( $post_type->cap->publish_posts ) ) { 393 465 $rels[] = 'https://api.w.org/action-publish'; … … 399 471 400 472 return $rels; 473 } 474 475 /** 476 * Overwrites the default protected title format. 477 * 478 * By default, WordPress will show password protected posts with a title of 479 * "Protected: %s", as the REST API communicates the protected status of a post 480 * in a machine readable format, we remove the "Protected: " prefix. 481 * 482 * @since 5.9.0 483 * 484 * @return string Protected title format. 485 */ 486 public function protected_title_format() { 487 return '%s'; 401 488 } 402 489 -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-revisions-controller.php
r57624 r57628 15 15 * @see WP_REST_Controller 16 16 */ 17 class WP_REST_Global_Styles_Revisions_Controller extends WP_REST_ Revisions_Controller {18 /** 19 * Parent controller.20 * 21 * @since 6. 5.022 * @var WP_REST_Controller23 */ 24 pr ivate $parent_controller;17 class WP_REST_Global_Styles_Revisions_Controller extends WP_REST_Controller { 18 /** 19 * Parent post type. 20 * 21 * @since 6.3.0 22 * @var string 23 */ 24 protected $parent_post_type; 25 25 26 26 /** … … 36 36 * 37 37 * @since 6.3.0 38 * @since 6.5.0 Extends class from WP_REST_Revisions_Controller. 39 * 40 * @param string $parent_post_type Post type of the parent. 41 */ 42 public function __construct( $parent_post_type ) { 43 parent::__construct( $parent_post_type ); 44 $post_type_object = get_post_type_object( $parent_post_type ); 45 $parent_controller = $post_type_object->get_rest_controller(); 46 47 if ( ! $parent_controller ) { 48 $parent_controller = new WP_REST_Global_Styles_Controller( $parent_post_type ); 49 } 50 51 $this->parent_controller = $parent_controller; 52 $this->rest_base = 'revisions'; 53 $this->parent_base = ! empty( $post_type_object->rest_base ) ? $post_type_object->rest_base : $post_type_object->name; 54 $this->namespace = ! empty( $post_type_object->rest_namespace ) ? $post_type_object->rest_namespace : 'wp/v2'; 38 */ 39 public function __construct() { 40 $this->parent_post_type = 'wp_global_styles'; 41 $this->rest_base = 'revisions'; 42 $this->parent_base = 'global-styles'; 43 $this->namespace = 'wp/v2'; 55 44 } 56 45 … … 75 64 'methods' => WP_REST_Server::READABLE, 76 65 'callback' => array( $this, 'get_items' ), 77 'permission_callback' => array( $this, 'get_item s_permissions_check' ),66 'permission_callback' => array( $this, 'get_item_permissions_check' ), 78 67 'args' => $this->get_collection_params(), 79 68 ), … … 107 96 ) 108 97 ); 98 } 99 100 /** 101 * Retrieves the query params for collections. 102 * 103 * Inherits from WP_REST_Controller::get_collection_params(), 104 * also reflects changes to return value WP_REST_Revisions_Controller::get_collection_params(). 105 * 106 * @since 6.3.0 107 * 108 * @return array Collection parameters. 109 */ 110 public function get_collection_params() { 111 $collection_params = parent::get_collection_params(); 112 $collection_params['context']['default'] = 'view'; 113 $collection_params['offset'] = array( 114 'description' => __( 'Offset the result set by a specific number of items.' ), 115 'type' => 'integer', 116 ); 117 unset( $collection_params['search'] ); 118 unset( $collection_params['per_page']['default'] ); 119 120 return $collection_params; 109 121 } 110 122 … … 258 270 259 271 /** 272 * Retrieves one global styles revision from the collection. 273 * 274 * @since 6.5.0 275 * 276 * @param WP_REST_Request $request Full details about the request. 277 * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. 278 */ 279 public function get_item( $request ) { 280 $parent = $this->get_parent( $request['parent'] ); 281 if ( is_wp_error( $parent ) ) { 282 return $parent; 283 } 284 285 $revision = $this->get_revision( $request['id'] ); 286 if ( is_wp_error( $revision ) ) { 287 return $revision; 288 } 289 290 $response = $this->prepare_item_for_response( $revision, $request ); 291 return rest_ensure_response( $response ); 292 } 293 294 /** 295 * Gets the global styles revision, if the ID is valid. 296 * 297 * @since 6.5.0 298 * 299 * @param int $id Supplied ID. 300 * @return WP_Post|WP_Error Revision post object if ID is valid, WP_Error otherwise. 301 */ 302 protected function get_revision( $id ) { 303 $error = new WP_Error( 304 'rest_post_invalid_id', 305 __( 'Invalid global styles revision ID.' ), 306 array( 'status' => 404 ) 307 ); 308 309 if ( (int) $id <= 0 ) { 310 return $error; 311 } 312 313 $revision = get_post( (int) $id ); 314 if ( empty( $revision ) || empty( $revision->ID ) || 'revision' !== $revision->post_type ) { 315 return $error; 316 } 317 318 return $revision; 319 } 320 321 /** 322 * Checks the post_date_gmt or modified_gmt and prepare any post or 323 * modified date for single post output. 324 * 325 * Duplicate of WP_REST_Revisions_Controller::prepare_date_response. 326 * 327 * @since 6.3.0 328 * 329 * @param string $date_gmt GMT publication time. 330 * @param string|null $date Optional. Local publication time. Default null. 331 * @return string|null ISO8601/RFC3339 formatted datetime, otherwise null. 332 */ 333 protected function prepare_date_response( $date_gmt, $date = null ) { 334 if ( '0000-00-00 00:00:00' === $date_gmt ) { 335 return null; 336 } 337 338 if ( isset( $date ) ) { 339 return mysql_to_rfc3339( $date ); 340 } 341 342 return mysql_to_rfc3339( $date_gmt ); 343 } 344 345 /** 260 346 * Prepares the revision for the REST response. 261 347 * … … 326 412 * 327 413 * @since 6.3.0 328 * @since 6.5.0 Merged parent and parent controller schema data.329 414 * 330 415 * @return array Item schema data. … … 335 420 } 336 421 337 $schema = parent::get_item_schema(); 338 $parent_schema = $this->parent_controller->get_item_schema(); 339 $schema['properties'] = array_merge( $schema['properties'], $parent_schema['properties'] ); 340 341 unset( $schema['properties']['guid'] ); 342 unset( $schema['properties']['slug'] ); 343 unset( $schema['properties']['meta'] ); 344 unset( $schema['properties']['content'] ); 345 unset( $schema['properties']['title'] ); 422 $schema = array( 423 '$schema' => 'http://json-schema.org/draft-04/schema#', 424 'title' => "{$this->parent_post_type}-revision", 425 'type' => 'object', 426 // Base properties for every revision. 427 'properties' => array( 428 429 /* 430 * Adds settings and styles from the WP_REST_Revisions_Controller item fields. 431 * Leaves out GUID as global styles shouldn't be accessible via URL. 432 */ 433 'author' => array( 434 'description' => __( 'The ID for the author of the revision.' ), 435 'type' => 'integer', 436 'context' => array( 'view', 'edit', 'embed' ), 437 ), 438 'date' => array( 439 'description' => __( "The date the revision was published, in the site's timezone." ), 440 'type' => 'string', 441 'format' => 'date-time', 442 'context' => array( 'view', 'edit', 'embed' ), 443 ), 444 'date_gmt' => array( 445 'description' => __( 'The date the revision was published, as GMT.' ), 446 'type' => 'string', 447 'format' => 'date-time', 448 'context' => array( 'view', 'edit' ), 449 ), 450 'id' => array( 451 'description' => __( 'Unique identifier for the revision.' ), 452 'type' => 'integer', 453 'context' => array( 'view', 'edit', 'embed' ), 454 ), 455 'modified' => array( 456 'description' => __( "The date the revision was last modified, in the site's timezone." ), 457 'type' => 'string', 458 'format' => 'date-time', 459 'context' => array( 'view', 'edit' ), 460 ), 461 'modified_gmt' => array( 462 'description' => __( 'The date the revision was last modified, as GMT.' ), 463 'type' => 'string', 464 'format' => 'date-time', 465 'context' => array( 'view', 'edit' ), 466 ), 467 'parent' => array( 468 'description' => __( 'The ID for the parent of the revision.' ), 469 'type' => 'integer', 470 'context' => array( 'view', 'edit', 'embed' ), 471 ), 472 473 // Adds settings and styles from the WP_REST_Global_Styles_Controller parent schema. 474 'styles' => array( 475 'description' => __( 'Global styles.' ), 476 'type' => array( 'object' ), 477 'context' => array( 'view', 'edit' ), 478 ), 479 'settings' => array( 480 'description' => __( 'Global settings.' ), 481 'type' => array( 'object' ), 482 'context' => array( 'view', 'edit' ), 483 ), 484 ), 485 ); 346 486 347 487 $this->schema = $schema; … … 351 491 352 492 /** 353 * Retrieves the query params for collections. 354 * Removes params that are not supported by global styles revisions. 355 * 356 * @since 6.5.0 357 * 358 * @return array Collection parameters. 359 */ 360 public function get_collection_params() { 361 $query_params = parent::get_collection_params(); 362 unset( $query_params['exclude'] ); 363 unset( $query_params['include'] ); 364 unset( $query_params['search'] ); 365 unset( $query_params['order'] ); 366 unset( $query_params['orderby'] ); 367 return $query_params; 493 * Checks if a given request has access to read a single global style. 494 * 495 * @since 6.3.0 496 * 497 * @param WP_REST_Request $request Full details about the request. 498 * @return true|WP_Error True if the request has read access, WP_Error object otherwise. 499 */ 500 public function get_item_permissions_check( $request ) { 501 $post = $this->get_parent( $request['parent'] ); 502 if ( is_wp_error( $post ) ) { 503 return $post; 504 } 505 506 /* 507 * The same check as WP_REST_Global_Styles_Controller::get_item_permissions_check. 508 */ 509 if ( ! current_user_can( 'read_post', $post->ID ) ) { 510 return new WP_Error( 511 'rest_cannot_view', 512 __( 'Sorry, you are not allowed to view revisions for this global style.' ), 513 array( 'status' => rest_authorization_required_code() ) 514 ); 515 } 516 517 return true; 518 } 519 520 /** 521 * Gets the parent post, if the ID is valid. 522 * 523 * Duplicate of WP_REST_Revisions_Controller::get_parent. 524 * 525 * @since 6.3.0 526 * 527 * @param int $parent_post_id Supplied ID. 528 * @return WP_Post|WP_Error Post object if ID is valid, WP_Error otherwise. 529 */ 530 protected function get_parent( $parent_post_id ) { 531 $error = new WP_Error( 532 'rest_post_invalid_parent', 533 __( 'Invalid post parent ID.' ), 534 array( 'status' => 404 ) 535 ); 536 537 if ( (int) $parent_post_id <= 0 ) { 538 return $error; 539 } 540 541 $parent_post = get_post( (int) $parent_post_id ); 542 543 if ( empty( $parent_post ) || empty( $parent_post->ID ) 544 || $this->parent_post_type !== $parent_post->post_type 545 ) { 546 return $error; 547 } 548 549 return $parent_post; 368 550 } 369 551 } -
trunk/src/wp-settings.php
r57624 r57628 277 277 require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-attachments-controller.php'; 278 278 require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-global-styles-controller.php'; 279 require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-global-styles-revisions-controller.php'; 279 280 require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-post-types-controller.php'; 280 281 require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-post-statuses-controller.php'; 281 282 require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-revisions-controller.php'; 282 require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-global-styles-revisions-controller.php';283 283 require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-template-revisions-controller.php'; 284 284 require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-autosaves-controller.php'; -
trunk/tests/phpunit/tests/rest-api/rest-global-styles-revisions-controller.php
r57624 r57628 421 421 /** 422 422 * @ticket 58524 423 * @ticket 60131424 423 * 425 424 * @covers WP_REST_Global_Styles_Controller::get_item_permissions_check … … 430 429 $response = rest_get_server()->dispatch( $request ); 431 430 432 $this->assertErrorResponse( 'rest_cannot_ read', $response, 403 );431 $this->assertErrorResponse( 'rest_cannot_view', $response, 403 ); 433 432 } 434 433 … … 831 830 */ 832 831 public function test_context_param() { 833 // Controller does not implement get_context_param().832 // Controller does not implement test_context_param(). 834 833 } 835 834 -
trunk/tests/qunit/fixtures/wp-api-generated.js
r57624 r57628 5806 5806 "default": false, 5807 5807 "description": "Whether to bypass Trash and force deletion.", 5808 "required": false5809 }5810 }5811 }5812 ]5813 },5814 "/wp/v2/global-styles/(?P<parent>[\\d]+)/revisions": {5815 "namespace": "wp/v2",5816 "methods": [5817 "GET"5818 ],5819 "endpoints": [5820 {5821 "methods": [5822 "GET"5823 ],5824 "args": {5825 "parent": {5826 "description": "The ID for the parent of the revision.",5827 "type": "integer",5828 "required": false5829 },5830 "context": {5831 "description": "Scope under which the request is made; determines fields present in response.",5832 "type": "string",5833 "enum": [5834 "view",5835 "embed",5836 "edit"5837 ],5838 "default": "view",5839 "required": false5840 },5841 "page": {5842 "description": "Current page of the collection.",5843 "type": "integer",5844 "default": 1,5845 "minimum": 1,5846 "required": false5847 },5848 "per_page": {5849 "description": "Maximum number of items to be returned in result set.",5850 "type": "integer",5851 "minimum": 1,5852 "maximum": 100,5853 "required": false5854 },5855 "offset": {5856 "description": "Offset the result set by a specific number of items.",5857 "type": "integer",5858 "required": false5859 }5860 }5861 }5862 ]5863 },5864 "/wp/v2/global-styles/(?P<parent>[\\d]+)/revisions/(?P<id>[\\d]+)": {5865 "namespace": "wp/v2",5866 "methods": [5867 "GET"5868 ],5869 "endpoints": [5870 {5871 "methods": [5872 "GET"5873 ],5874 "args": {5875 "parent": {5876 "description": "The ID for the parent of the global styles revision.",5877 "type": "integer",5878 "required": false5879 },5880 "id": {5881 "description": "Unique identifier for the global styles revision.",5882 "type": "integer",5883 "required": false5884 },5885 "context": {5886 "description": "Scope under which the request is made; determines fields present in response.",5887 "type": "string",5888 "enum": [5889 "view",5890 "embed",5891 "edit"5892 ],5893 "default": "view",5894 "required": false5895 }5896 }5897 }5898 ]5899 },5900 "/wp/v2/global-styles/themes/(?P<stylesheet>[\\/\\s%\\w\\.\\(\\)\\[\\]\\@_\\-]+)/variations": {5901 "namespace": "wp/v2",5902 "methods": [5903 "GET"5904 ],5905 "endpoints": [5906 {5907 "methods": [5908 "GET"5909 ],5910 "args": {5911 "stylesheet": {5912 "description": "The theme identifier",5913 "type": "string",5914 "required": false5915 }5916 }5917 }5918 ]5919 },5920 "/wp/v2/global-styles/themes/(?P<stylesheet>[^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)": {5921 "namespace": "wp/v2",5922 "methods": [5923 "GET"5924 ],5925 "endpoints": [5926 {5927 "methods": [5928 "GET"5929 ],5930 "args": {5931 "stylesheet": {5932 "description": "The theme identifier",5933 "type": "string",5934 "required": false5935 }5936 }5937 }5938 ]5939 },5940 "/wp/v2/global-styles/(?P<id>[\\/\\w-]+)": {5941 "namespace": "wp/v2",5942 "methods": [5943 "GET",5944 "POST",5945 "PUT",5946 "PATCH"5947 ],5948 "endpoints": [5949 {5950 "methods": [5951 "GET"5952 ],5953 "args": {5954 "id": {5955 "description": "The id of a template",5956 "type": "string",5957 "required": false5958 }5959 }5960 },5961 {5962 "methods": [5963 "POST",5964 "PUT",5965 "PATCH"5966 ],5967 "args": {5968 "styles": {5969 "description": "Global styles.",5970 "type": [5971 "object"5972 ],5973 "required": false5974 },5975 "settings": {5976 "description": "Global settings.",5977 "type": [5978 "object"5979 ],5980 "required": false5981 },5982 "title": {5983 "description": "Title of the global styles variation.",5984 "type": [5985 "object",5986 "string"5987 ],5988 "properties": {5989 "raw": {5990 "description": "Title for the global styles variation, as it exists in the database.",5991 "type": "string",5992 "context": [5993 "view",5994 "edit",5995 "embed"5996 ]5997 },5998 "rendered": {5999 "description": "HTML title for the post, transformed for display.",6000 "type": "string",6001 "context": [6002 "view",6003 "edit",6004 "embed"6005 ],6006 "readonly": true6007 }6008 },6009 5808 "required": false 6010 5809 } … … 9371 9170 "wp_template": "wp_template", 9372 9171 "wp_template_part": "wp_template_part", 9373 "wp_global_styles": "wp_global_styles",9374 9172 "wp_navigation": "wp_navigation", 9375 9173 "wp_font_family": "wp_font_family", … … 10578 10376 ], 10579 10377 "default": "view", 10378 "required": false 10379 } 10380 } 10381 } 10382 ] 10383 }, 10384 "/wp/v2/global-styles/(?P<parent>[\\d]+)/revisions": { 10385 "namespace": "wp/v2", 10386 "methods": [ 10387 "GET" 10388 ], 10389 "endpoints": [ 10390 { 10391 "methods": [ 10392 "GET" 10393 ], 10394 "args": { 10395 "parent": { 10396 "description": "The ID for the parent of the revision.", 10397 "type": "integer", 10398 "required": false 10399 }, 10400 "context": { 10401 "description": "Scope under which the request is made; determines fields present in response.", 10402 "type": "string", 10403 "enum": [ 10404 "view", 10405 "embed", 10406 "edit" 10407 ], 10408 "default": "view", 10409 "required": false 10410 }, 10411 "page": { 10412 "description": "Current page of the collection.", 10413 "type": "integer", 10414 "default": 1, 10415 "minimum": 1, 10416 "required": false 10417 }, 10418 "per_page": { 10419 "description": "Maximum number of items to be returned in result set.", 10420 "type": "integer", 10421 "minimum": 1, 10422 "maximum": 100, 10423 "required": false 10424 }, 10425 "offset": { 10426 "description": "Offset the result set by a specific number of items.", 10427 "type": "integer", 10428 "required": false 10429 } 10430 } 10431 } 10432 ] 10433 }, 10434 "/wp/v2/global-styles/(?P<parent>[\\d]+)/revisions/(?P<id>[\\d]+)": { 10435 "namespace": "wp/v2", 10436 "methods": [ 10437 "GET" 10438 ], 10439 "endpoints": [ 10440 { 10441 "methods": [ 10442 "GET" 10443 ], 10444 "args": { 10445 "parent": { 10446 "description": "The ID for the parent of the global styles revision.", 10447 "type": "integer", 10448 "required": false 10449 }, 10450 "id": { 10451 "description": "Unique identifier for the global styles revision.", 10452 "type": "integer", 10453 "required": false 10454 }, 10455 "context": { 10456 "description": "Scope under which the request is made; determines fields present in response.", 10457 "type": "string", 10458 "enum": [ 10459 "view", 10460 "embed", 10461 "edit" 10462 ], 10463 "default": "view", 10464 "required": false 10465 } 10466 } 10467 } 10468 ] 10469 }, 10470 "/wp/v2/global-styles/themes/(?P<stylesheet>[\\/\\s%\\w\\.\\(\\)\\[\\]\\@_\\-]+)/variations": { 10471 "namespace": "wp/v2", 10472 "methods": [ 10473 "GET" 10474 ], 10475 "endpoints": [ 10476 { 10477 "methods": [ 10478 "GET" 10479 ], 10480 "args": { 10481 "stylesheet": { 10482 "description": "The theme identifier", 10483 "type": "string", 10484 "required": false 10485 } 10486 } 10487 } 10488 ] 10489 }, 10490 "/wp/v2/global-styles/themes/(?P<stylesheet>[^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)": { 10491 "namespace": "wp/v2", 10492 "methods": [ 10493 "GET" 10494 ], 10495 "endpoints": [ 10496 { 10497 "methods": [ 10498 "GET" 10499 ], 10500 "args": { 10501 "stylesheet": { 10502 "description": "The theme identifier", 10503 "type": "string", 10504 "required": false 10505 } 10506 } 10507 } 10508 ] 10509 }, 10510 "/wp/v2/global-styles/(?P<id>[\\/\\w-]+)": { 10511 "namespace": "wp/v2", 10512 "methods": [ 10513 "GET", 10514 "POST", 10515 "PUT", 10516 "PATCH" 10517 ], 10518 "endpoints": [ 10519 { 10520 "methods": [ 10521 "GET" 10522 ], 10523 "args": { 10524 "id": { 10525 "description": "The id of a template", 10526 "type": "string", 10527 "required": false 10528 } 10529 } 10530 }, 10531 { 10532 "methods": [ 10533 "POST", 10534 "PUT", 10535 "PATCH" 10536 ], 10537 "args": { 10538 "styles": { 10539 "description": "Global styles.", 10540 "type": [ 10541 "object" 10542 ], 10543 "required": false 10544 }, 10545 "settings": { 10546 "description": "Global settings.", 10547 "type": [ 10548 "object" 10549 ], 10550 "required": false 10551 }, 10552 "title": { 10553 "description": "Title of the global styles variation.", 10554 "type": [ 10555 "object", 10556 "string" 10557 ], 10558 "properties": { 10559 "raw": { 10560 "description": "Title for the global styles variation, as it exists in the database.", 10561 "type": "string", 10562 "context": [ 10563 "view", 10564 "edit", 10565 "embed" 10566 ] 10567 }, 10568 "rendered": { 10569 "description": "HTML title for the post, transformed for display.", 10570 "type": "string", 10571 "context": [ 10572 "view", 10573 "edit", 10574 "embed" 10575 ], 10576 "readonly": true 10577 } 10578 }, 10580 10579 "required": false 10581 10580 } … … 12976 12975 } 12977 12976 }, 12978 "wp_global_styles": {12979 "description": "Global styles to include in themes.",12980 "hierarchical": false,12981 "has_archive": false,12982 "name": "Global Styles",12983 "slug": "wp_global_styles",12984 "icon": null,12985 "taxonomies": [],12986 "rest_base": "global-styles",12987 "rest_namespace": "wp/v2",12988 "_links": {12989 "collection": [12990 {12991 "href": "http://example.org/index.php?rest_route=/wp/v2/types"12992 }12993 ],12994 "wp:items": [12995 {12996 "href": "http://example.org/index.php?rest_route=/wp/v2/global-styles"12997 }12998 ],12999 "curies": [13000 {13001 "name": "wp",13002 "href": "https://api.w.org/{rel}",13003 "templated": true13004 }13005 ]13006 }13007 },13008 12977 "wp_navigation": { 13009 12978 "description": "Navigation menus that can be inserted into your site.",
Note: See TracChangeset
for help on using the changeset viewer.