| @@ -10,38 +10,11 @@ | ||
| 10 | 10 | die( 'Silence is golden.' ); |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | - * Overrides the REST controller for the `wp_global_styles` post type. | |
| 15 | - * | |
| 16 | - * @param array $args Array of arguments for registering a post type. | |
| 17 | - * See the register_post_type() function for accepted arguments. | |
| 18 | - * | |
| 19 | - * @return array Array of arguments for registering a post type. | |
| 14 | + * Registers the Global Styles REST API routes. | |
| 20 | 15 | */ |
| 21 | -function gutenberg_override_global_styles_endpoint( array $args ): array { | |
| 22 | - $args['rest_controller_class'] = 'WP_REST_Global_Styles_Controller_Gutenberg'; | |
| 23 | - $args['late_route_registration'] = true; | |
| 24 | - $args['show_in_rest'] = true; | |
| 25 | - $args['rest_base'] = 'global-styles'; | |
| 26 | - | |
| 27 | - return $args; | |
| 16 | +function gutenberg_register_global_styles_endpoints() { | |
| 17 | + $global_styles_controller = new WP_REST_Global_Styles_Controller_Gutenberg(); | |
| 18 | + $global_styles_controller->register_routes(); | |
| 28 | 19 | } |
| 29 | -add_filter( 'register_wp_global_styles_post_type_args', 'gutenberg_override_global_styles_endpoint' ); | |
| 30 | - | |
| 31 | -/** | |
| 32 | - * Registers the Edit Site Export REST API routes. | |
| 33 | - */ | |
| 34 | -function gutenberg_register_edit_site_export_controller_endpoints() { | |
| 35 | - $edit_site_export_controller = new WP_REST_Edit_Site_Export_Controller_Gutenberg(); | |
| 36 | - $edit_site_export_controller->register_routes(); | |
| 37 | -} | |
| 38 | -add_action( 'rest_api_init', 'gutenberg_register_edit_site_export_controller_endpoints' ); | |
| 39 | - | |
| 40 | -/** | |
| 41 | - * Registers the Icons Registry REST API routes. | |
| 42 | - */ | |
| 43 | -function gutenberg_register_icon_controller_endpoints() { | |
| 44 | - $icons_controller = new WP_REST_Icons_Controller_Gutenberg(); | |
| 45 | - $icons_controller->register_routes(); | |
| 46 | -} | |
| 47 | -add_action( 'rest_api_init', 'gutenberg_register_icon_controller_endpoints' ); | |
| 20 | +add_action( 'rest_api_init', 'gutenberg_register_global_styles_endpoints' ); | |