REST API: Add endpoints for blocks.

`WP_REST_Block_Renderer_Controller` allows rendering of server-side rendered blocks, whilst `WP_REST_Blocks_Controller` allows retrieving of reusable blocks.

Merges [43805] and [43806] from the 5.0 branch to trunk.

Props desrosj, danielbachhuber, pento, Presskopp, swissspidy.
See #45065, #45098.


git-svn-id: https://develop.svn.wordpress.org/trunk@44150 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jeremy Felt
2018-12-14 02:34:28 +00:00
parent aadbdd7ad0
commit 7702b535be
9 changed files with 1776 additions and 44 deletions

View File

@@ -249,6 +249,10 @@ function create_initial_rest_routes() {
$controller = new WP_REST_Search_Controller( $search_handlers );
$controller->register_routes();
// Block Renderer.
$controller = new WP_REST_Block_Renderer_Controller;
$controller->register_routes();
// Settings.
$controller = new WP_REST_Settings_Controller;
$controller->register_routes();
@@ -256,6 +260,7 @@ function create_initial_rest_routes() {
// Themes.
$controller = new WP_REST_Themes_Controller;
$controller->register_routes();
}
/**