| @@ -22,8 +22,17 @@ | ||
| 22 | 22 | } |
| 23 | 23 | add_action( 'rest_api_init', 'gutenberg_register_url_details_routes' ); |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | + * Registers the block pattern directory. | |
| 27 | + */ | |
| 28 | +function gutenberg_register_rest_pattern_directory() { | |
| 29 | + $block_directory_controller = new WP_REST_Pattern_Directory_Controller(); | |
| 30 | + $block_directory_controller->register_routes(); | |
| 31 | +} | |
| 32 | +add_filter( 'rest_api_init', 'gutenberg_register_rest_pattern_directory' ); | |
| 33 | + | |
| 34 | +/** | |
| 26 | 35 | * Registers the menu locations REST API routes. |
| 27 | 36 | */ |
| 28 | 37 | function gutenberg_register_rest_menu_location() { |
| 29 | 38 | $nav_menu_location = new WP_REST_Menu_Locations_Controller(); |
| @@ -49,8 +58,23 @@ | ||
| 49 | 58 | } |
| 50 | 59 | add_action( 'rest_api_init', 'gutenberg_register_rest_customizer_nonces' ); |
| 51 | 60 | |
| 52 | 61 | /** |
| 62 | + * Registers the Sidebars & Widgets REST API routes. | |
| 63 | + */ | |
| 64 | +function gutenberg_register_sidebars_and_widgets_endpoint() { | |
| 65 | + $sidebars = new WP_REST_Sidebars_Controller(); | |
| 66 | + $sidebars->register_routes(); | |
| 67 | + | |
| 68 | + $widgets = new WP_REST_Widgets_Controller(); | |
| 69 | + $widgets->register_routes(); | |
| 70 | + | |
| 71 | + $widget_types = new WP_REST_Widget_Types_Controller(); | |
| 72 | + $widget_types->register_routes(); | |
| 73 | +} | |
| 74 | +add_action( 'rest_api_init', 'gutenberg_register_sidebars_and_widgets_endpoint' ); | |
| 75 | + | |
| 76 | +/** | |
| 53 | 77 | * Registers the Block editor settings REST API routes. |
| 54 | 78 | */ |
| 55 | 79 | function gutenberg_register_block_editor_settings() { |
| 56 | 80 | $editor_settings = new WP_REST_Block_Editor_Settings_Controller(); |
| @@ -208,8 +232,17 @@ | ||
| 208 | 232 | ); |
| 209 | 233 | return $query_params; |
| 210 | 234 | } |
| 211 | 235 | add_filter( 'rest_user_collection_params', 'gutenberg_rest_user_collection_params_has_published_posts' ); |
| 236 | + | |
| 237 | +/** | |
| 238 | + * Registers the Global Styles REST API routes. | |
| 239 | + */ | |
| 240 | +function gutenberg_register_global_styles_endpoints() { | |
| 241 | + $editor_settings = new Gutenberg_REST_Global_Styles_Controller(); | |
| 242 | + $editor_settings->register_routes(); | |
| 243 | +} | |
| 244 | +add_action( 'rest_api_init', 'gutenberg_register_global_styles_endpoints' ); | |
| 212 | 245 | |
| 213 | 246 | /** |
| 214 | 247 | * Registers the Edit Site's Export REST API routes. |
| 215 | 248 | * |