PluginProbe
Gutenberg / 17.0.2
Gutenberg v17.0.2
24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 All 403 releases
← All changes | lib/experimental/rest-api.php +32 -1 23.7.017.0.2 View file →
@@ -10,8 +10,17 @@
10 10 die( 'Silence is golden.' );
11 11 }
12 12
13 13 /**
14 + * Registers the customizer nonces REST API routes.
15 + */
16 +function gutenberg_register_rest_customizer_nonces() {
17 + $customizer_nonces = new WP_Rest_Customizer_Nonces();
18 + $customizer_nonces->register_routes();
19 +}
20 +add_action( 'rest_api_init', 'gutenberg_register_rest_customizer_nonces' );
21 +
22 +/**
14 23 * Registers the Block editor settings REST API routes.
15 24 */
16 25 function gutenberg_register_block_editor_settings() {
17 26 $editor_settings = new WP_REST_Block_Editor_Settings_Controller();
@@ -28,9 +37,9 @@
28 37 * is actually publish in order to return the future permalink format.
29 38 *
30 39 * This is a temporary fix until we can patch get_sample_permalink()
31 40 *
32 - * @link https://core.trac.wordpress.org/ticket/46266
41 + * @see https://core.trac.wordpress.org/ticket/46266
33 42 *
34 43 * @param array $permalink Array containing the sample permalink with placeholder for the post name, and the post name.
35 44 * @param int $id ID of the post.
36 45 * @param string $title Title of the post.
@@ -91,4 +100,26 @@
91 100
92 101 return $permalink;
93 102 }
94 103 add_filter( 'get_sample_permalink', 'gutenberg_auto_draft_get_sample_permalink', 10, 5 );
104 +
105 +if ( ! function_exists( 'wp_api_template_revision_args' ) ) {
106 + /**
107 + * Hook in to the template and template part post types and decorate
108 + * the rest endpoint with the revision count.
109 + *
110 + * When merging to core, this can be removed once Gutenberg_REST_Template_Revision_Count is
111 + * merged with WP_REST_Template_Controller.
112 + *
113 + * @param array $args Current registered post type args.
114 + * @param string $post_type Name of post type.
115 + *
116 + * @return array
117 + */
118 + function wp_api_template_revision_args( $args, $post_type ) {
119 + if ( 'wp_template' === $post_type || 'wp_template_part' === $post_type ) {
120 + $args['rest_controller_class'] = 'Gutenberg_REST_Template_Revision_Count';
121 + }
122 + return $args;
123 + }
124 +}
125 +add_filter( 'register_post_type_args', 'wp_api_template_revision_args', 10, 2 );