mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 21:08:44 +01:00
REST API: Introduce themes endpoint to expose theme-supports values for the active theme.
In order to correctly render parts of its UI, the new editor needs to be aware of the active theme's post-formats and post-thumbnails support. This data is exposed by querying for the active theme on a new /wp/v2/themes endpoint for sufficiently privileged users. props desrosj. Fixes #45016. git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43734 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
51d8512f8d
commit
ca79cbbca7
@ -233,6 +233,10 @@ function create_initial_rest_routes() {
|
||||
// Settings.
|
||||
$controller = new WP_REST_Settings_Controller;
|
||||
$controller->register_routes();
|
||||
|
||||
// Themes.
|
||||
$controller = new WP_REST_Themes_Controller;
|
||||
$controller->register_routes();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -234,6 +234,7 @@ require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-terms-controller.p
|
||||
require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-users-controller.php' );
|
||||
require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-comments-controller.php' );
|
||||
require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-settings-controller.php' );
|
||||
require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-themes-controller.php' );
|
||||
require( ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-meta-fields.php' );
|
||||
require( ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-comment-meta-fields.php' );
|
||||
require( ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-post-meta-fields.php' );
|
||||
|
@ -111,6 +111,7 @@ class WP_Test_REST_Schema_Initialization extends WP_Test_REST_TestCase {
|
||||
'/wp/v2/comments',
|
||||
'/wp/v2/comments/(?P<id>[\\d]+)',
|
||||
'/wp/v2/settings',
|
||||
'/wp/v2/themes',
|
||||
);
|
||||
|
||||
$this->assertEquals( $expected_routes, $routes );
|
||||
|
@ -3517,6 +3517,57 @@ mockedApiResponse.Schema = {
|
||||
"_links": {
|
||||
"self": "http://example.org/index.php?rest_route=/wp/v2/settings"
|
||||
}
|
||||
},
|
||||
"/wp/v2/themes": {
|
||||
"namespace": "wp/v2",
|
||||
"methods": [
|
||||
"GET"
|
||||
],
|
||||
"endpoints": [
|
||||
{
|
||||
"methods": [
|
||||
"GET"
|
||||
],
|
||||
"args": {
|
||||
"context": {
|
||||
"required": false,
|
||||
"description": "Scope under which the request is made; determines fields present in response.",
|
||||
"type": "string"
|
||||
},
|
||||
"page": {
|
||||
"required": false,
|
||||
"default": 1,
|
||||
"description": "Current page of the collection.",
|
||||
"type": "integer"
|
||||
},
|
||||
"per_page": {
|
||||
"required": false,
|
||||
"default": 10,
|
||||
"description": "Maximum number of items to be returned in result set.",
|
||||
"type": "integer"
|
||||
},
|
||||
"search": {
|
||||
"required": false,
|
||||
"description": "Limit results to those matching a string.",
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"required": true,
|
||||
"description": "Limit result set to themes assigned one or more statuses.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"enum": [
|
||||
"active"
|
||||
],
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"_links": {
|
||||
"self": "http://example.org/index.php?rest_route=/wp/v2/themes"
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user