| @@ -12,4 +12,64 @@ | ||
| 12 | 12 | $editor_settings = new Gutenberg_REST_Global_Styles_Controller(); |
| 13 | 13 | $editor_settings->register_routes(); |
| 14 | 14 | } |
| 15 | 15 | add_action( 'rest_api_init', 'gutenberg_register_global_styles_endpoints' ); |
| 16 | + | |
| 17 | + | |
| 18 | +/** | |
| 19 | + * Registers the block pattern directory. | |
| 20 | + */ | |
| 21 | +function gutenberg_register_rest_pattern_directory() { | |
| 22 | + $pattern_directory_controller = new Gutenberg_REST_Pattern_Directory_Controller(); | |
| 23 | + $pattern_directory_controller->register_routes(); | |
| 24 | +} | |
| 25 | +add_action( 'rest_api_init', 'gutenberg_register_rest_pattern_directory' ); | |
| 26 | + | |
| 27 | +/** | |
| 28 | + * Registers the Edit Site's Export REST API routes. | |
| 29 | + * | |
| 30 | + * @return void | |
| 31 | + */ | |
| 32 | +function gutenberg_register_edit_site_export_endpoint() { | |
| 33 | + $editor_settings = new Gutenberg_REST_Edit_Site_Export_Controller(); | |
| 34 | + $editor_settings->register_routes(); | |
| 35 | +} | |
| 36 | +add_action( 'rest_api_init', 'gutenberg_register_edit_site_export_endpoint' ); | |
| 37 | + | |
| 38 | + | |
| 39 | +/** | |
| 40 | + * Register a core site settings. | |
| 41 | + * | |
| 42 | + * Note: Needs to be backported into the `register_initial_settings` function. | |
| 43 | + */ | |
| 44 | +function gutenberg_register_site_settings() { | |
| 45 | + register_setting( | |
| 46 | + 'reading', | |
| 47 | + 'show_on_front', | |
| 48 | + array( | |
| 49 | + 'show_in_rest' => true, | |
| 50 | + 'type' => 'string', | |
| 51 | + 'description' => __( 'What to show on the front page', 'gutenberg' ), | |
| 52 | + ) | |
| 53 | + ); | |
| 54 | + | |
| 55 | + register_setting( | |
| 56 | + 'reading', | |
| 57 | + 'page_on_front', | |
| 58 | + array( | |
| 59 | + 'show_in_rest' => true, | |
| 60 | + 'type' => 'number', | |
| 61 | + 'description' => __( 'The ID of the page that should be displayed on the front page', 'gutenberg' ), | |
| 62 | + ) | |
| 63 | + ); | |
| 64 | + | |
| 65 | + register_setting( | |
| 66 | + 'reading', | |
| 67 | + 'page_for_posts', | |
| 68 | + array( | |
| 69 | + 'show_in_rest' => true, | |
| 70 | + 'type' => 'number', | |
| 71 | + 'description' => __( 'The ID of the page that should display the latest posts', 'gutenberg' ), | |
| 72 | + ) | |
| 73 | + ); | |
| 74 | +} | |
| 75 | +add_action( 'rest_api_init', 'gutenberg_register_site_settings', 10 ); | |