REST API: Add `inserter` field to the schema of Patterns endpoint

Backports changes from https://github.com/WordPress/gutenberg/pull/40416. Adds the missing `inserter` field to the Patterns item schema. This field was omitted from the response, and patterns that should be hidden in the inserter were visible.

Props mamaduka, ndiego.
See #55567.
Follow-up [53152].



Built from https://develop.svn.wordpress.org/trunk@53210


git-svn-id: http://core.svn.wordpress.org/trunk@52799 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
gziolo 2022-04-19 09:41:09 +00:00
parent 09688edc45
commit fba03a16ca
2 changed files with 8 additions and 1 deletions

View File

@ -127,6 +127,7 @@ class WP_REST_Block_Patterns_Controller extends WP_REST_Controller {
'categories' => 'categories', 'categories' => 'categories',
'keywords' => 'keywords', 'keywords' => 'keywords',
'content' => 'content', 'content' => 'content',
'inserter' => 'inserter',
); );
$data = array(); $data = array();
foreach ( $keys as $item_key => $rest_key ) { foreach ( $keys as $item_key => $rest_key ) {
@ -202,6 +203,12 @@ class WP_REST_Block_Patterns_Controller extends WP_REST_Controller {
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit', 'embed' ), 'context' => array( 'view', 'edit', 'embed' ),
), ),
'inserter' => array(
'description' => __( 'Determines whether the pattern is visible in inserter.' ),
'type' => 'boolean',
'readonly' => true,
'context' => array( 'view', 'edit', 'embed' ),
),
), ),
); );

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.0-beta1-53209'; $wp_version = '6.0-beta1-53210';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.