Changeset 57624
- Timestamp:
- 02/13/2024 02:07:38 PM (8 months ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-post-type.php
r56819 r57624 914 914 * 915 915 * @since 6.4.0 916 * @since 6.5.0 Prevents autosave class instantiation for wp_global_styles post types. 916 917 * 917 918 * @return WP_REST_Controller|null The controller instance, or null if the post type … … 923 924 } 924 925 925 if ( 'attachment' === $this->name) {926 if ( in_array( $this->name, array( 'attachment', 'wp_global_styles' ), true ) ) { 926 927 return null; 927 928 } -
trunk/src/wp-includes/post.php
r57548 r57624 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' => false, 483 'rewrite' => false, 484 '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' => 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( 485 489 'read' => 'edit_theme_options', 486 490 'create_posts' => 'edit_theme_options', … … 491 495 'delete_others_posts' => 'edit_theme_options', 492 496 ), 493 'map_meta_cap' => true,494 'supports' => array(497 'map_meta_cap' => true, 498 'supports' => array( 495 499 'title', 496 500 'editor', -
trunk/src/wp-includes/rest-api.php
r57548 r57624 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();332 324 $controller->register_routes(); 333 325 -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php
r56753 r57624 11 11 * Base Global Styles REST API Controller. 12 12 */ 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 } 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 ); 32 21 33 22 /** … … 195 184 * @return bool Whether the post can be read. 196 185 */ 197 p rotectedfunction check_read_permission( $post ) {186 public function check_read_permission( $post ) { 198 187 return current_user_can( 'read_post', $post->ID ); 199 }200 201 /**202 * Returns the given global styles config.203 *204 * @since 5.9.0205 *206 * @param WP_REST_Request $request The request instance.207 *208 * @return WP_REST_Response|WP_Error209 */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 );217 188 } 218 189 … … 240 211 241 212 return true; 242 }243 244 /**245 * Checks if a global style can be edited.246 *247 * @since 5.9.0248 *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.0260 *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 );291 213 } 292 214 … … 408 330 $response->add_links( $links ); 409 331 if ( ! empty( $links['self']['href'] ) ) { 410 $actions = $this->get_available_actions( );332 $actions = $this->get_available_actions( $post, $request ); 411 333 $self = $links['self']['href']; 412 334 foreach ( $actions as $rel ) { … … 432 354 433 355 $links = array( 434 'self' => array(356 'self' => array( 435 357 'href' => rest_url( trailingslashit( $base ) . $id ), 358 ), 359 'about' => array( 360 'href' => rest_url( 'wp/v2/types/' . $this->post_type ), 436 361 ), 437 362 ); … … 455 380 * @since 5.9.0 456 381 * @since 6.2.0 Added 'edit-css' action. 457 * 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. 458 386 * @return array List of link relations. 459 387 */ 460 protected function get_available_actions( ) {388 protected function get_available_actions( $post, $request ) { 461 389 $rels = array(); 462 390 463 $post_type = get_post_type_object( $ this->post_type );391 $post_type = get_post_type_object( $post->post_type ); 464 392 if ( current_user_can( $post_type->cap->publish_posts ) ) { 465 393 $rels[] = 'https://api.w.org/action-publish'; … … 471 399 472 400 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 of479 * "Protected: %s", as the REST API communicates the protected status of a post480 * in a machine readable format, we remove the "Protected: " prefix.481 *482 * @since 5.9.0483 *484 * @return string Protected title format.485 */486 public function protected_title_format() {487 return '%s';488 401 } 489 402 -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-revisions-controller.php
r57494 r57624 15 15 * @see WP_REST_Controller 16 16 */ 17 class WP_REST_Global_Styles_Revisions_Controller extends WP_REST_Controller { 18 /** 19 * Parent post type. 17 class WP_REST_Global_Styles_Revisions_Controller extends WP_REST_Revisions_Controller { 18 /** 19 * Parent controller. 20 * 21 * @since 6.5.0 22 * @var WP_REST_Controller 23 */ 24 private $parent_controller; 25 26 /** 27 * The base of the parent controller's route. 20 28 * 21 29 * @since 6.3.0 22 30 * @var string 23 31 */ 24 protected $parent_post_type;25 26 /**27 * The base of the parent controller's route.28 *29 * @since 6.3.030 * @var string31 */32 32 protected $parent_base; 33 33 … … 36 36 * 37 37 * @since 6.3.0 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'; 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'; 44 55 } 45 56 … … 64 75 'methods' => WP_REST_Server::READABLE, 65 76 'callback' => array( $this, 'get_items' ), 66 'permission_callback' => array( $this, 'get_item _permissions_check' ),77 'permission_callback' => array( $this, 'get_items_permissions_check' ), 67 78 'args' => $this->get_collection_params(), 68 79 ), … … 99 110 100 111 /** 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.0107 *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;121 }122 123 /**124 112 * Returns decoded JSON from post content string, 125 113 * or a 404 if not found. … … 270 258 271 259 /** 272 * Retrieves one global styles revision from the collection.273 *274 * @since 6.5.0275 *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.0298 *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 or323 * modified date for single post output.324 *325 * Duplicate of WP_REST_Revisions_Controller::prepare_date_response.326 *327 * @since 6.3.0328 *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 /**346 260 * Prepares the revision for the REST response. 347 261 * … … 412 326 * 413 327 * @since 6.3.0 328 * @since 6.5.0 Merged parent and parent controller schema data. 414 329 * 415 330 * @return array Item schema data. … … 420 335 } 421 336 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 ); 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'] ); 486 346 487 347 $this->schema = $schema; … … 491 351 492 352 /** 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; 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; 550 368 } 551 369 } -
trunk/src/wp-settings.php
r57622 r57624 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';280 279 require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-post-types-controller.php'; 281 280 require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-post-statuses-controller.php'; 282 281 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
r57494 r57624 421 421 /** 422 422 * @ticket 58524 423 * @ticket 60131 423 424 * 424 425 * @covers WP_REST_Global_Styles_Controller::get_item_permissions_check … … 429 430 $response = rest_get_server()->dispatch( $request ); 430 431 431 $this->assertErrorResponse( 'rest_cannot_ view', $response, 403 );432 $this->assertErrorResponse( 'rest_cannot_read', $response, 403 ); 432 433 } 433 434 … … 830 831 */ 831 832 public function test_context_param() { 832 // Controller does not implement test_context_param().833 // Controller does not implement get_context_param(). 833 834 } 834 835 -
trunk/tests/qunit/fixtures/wp-api-generated.js
r57603 r57624 5806 5806 "default": false, 5807 5807 "description": "Whether to bypass Trash and force deletion.", 5808 "required": false 5809 } 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": false 5829 }, 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": false 5840 }, 5841 "page": { 5842 "description": "Current page of the collection.", 5843 "type": "integer", 5844 "default": 1, 5845 "minimum": 1, 5846 "required": false 5847 }, 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": false 5854 }, 5855 "offset": { 5856 "description": "Offset the result set by a specific number of items.", 5857 "type": "integer", 5858 "required": false 5859 } 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": false 5879 }, 5880 "id": { 5881 "description": "Unique identifier for the global styles revision.", 5882 "type": "integer", 5883 "required": false 5884 }, 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": false 5895 } 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": false 5915 } 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": false 5935 } 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": false 5958 } 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": false 5974 }, 5975 "settings": { 5976 "description": "Global settings.", 5977 "type": [ 5978 "object" 5979 ], 5980 "required": false 5981 }, 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": true 6007 } 6008 }, 5808 6009 "required": false 5809 6010 } … … 9170 9371 "wp_template": "wp_template", 9171 9372 "wp_template_part": "wp_template_part", 9373 "wp_global_styles": "wp_global_styles", 9172 9374 "wp_navigation": "wp_navigation", 9173 9375 "wp_font_family": "wp_font_family", … … 10376 10578 ], 10377 10579 "default": "view", 10378 "required": false10379 }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": false10399 },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": false10410 },10411 "page": {10412 "description": "Current page of the collection.",10413 "type": "integer",10414 "default": 1,10415 "minimum": 1,10416 "required": false10417 },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": false10424 },10425 "offset": {10426 "description": "Offset the result set by a specific number of items.",10427 "type": "integer",10428 "required": false10429 }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": false10449 },10450 "id": {10451 "description": "Unique identifier for the global styles revision.",10452 "type": "integer",10453 "required": false10454 },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": false10465 }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": false10485 }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": false10505 }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": false10528 }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": false10544 },10545 "settings": {10546 "description": "Global settings.",10547 "type": [10548 "object"10549 ],10550 "required": false10551 },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": true10577 }10578 },10579 10580 "required": false 10580 10581 } … … 12975 12976 } 12976 12977 }, 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": true 13004 } 13005 ] 13006 } 13007 }, 12977 13008 "wp_navigation": { 12978 13009 "description": "Navigation menus that can be inserted into your site.",
Note: See TracChangeset
for help on using the changeset viewer.