Skip to content

Commit

Permalink
REST API: Add inserter field to the schema of Patterns endpoint
Browse files Browse the repository at this point in the history
Backports changes from WordPress/gutenberg#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].




git-svn-id: https://develop.svn.wordpress.org/trunk@53210 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
gziolo committed Apr 19, 2022
1 parent 699853b commit e8df37e
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public function prepare_item_for_response( $item, $request ) {
'categories' => 'categories',
'keywords' => 'keywords',
'content' => 'content',
'inserter' => 'inserter',
);
$data = array();
foreach ( $keys as $item_key => $rest_key ) {
Expand Down Expand Up @@ -202,6 +203,12 @@ public function get_item_schema() {
'readonly' => true,
'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' ),
),
),
);

Expand Down

0 comments on commit e8df37e

Please sign in to comment.