mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 12:50:28 +00:00
REST API: Indicate when a theme supports the Site editor in the Themes REST API response.
This changeset adds a `is_block_theme` property to each theme in the `wp/v2/themes` API response, which uses `WP_Theme::is_block_theme` to determinate whether the theme is block theme or not. Props grantmkin, ironprogrammer, zunaid321, azaozz, spacedmonkey, audrasjb, costdev. Fixes #58123. git-svn-id: https://develop.svn.wordpress.org/trunk@55951 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -326,6 +326,10 @@ class WP_REST_Themes_Controller extends WP_REST_Controller {
|
||||
}
|
||||
}
|
||||
|
||||
if ( rest_is_field_included( 'is_block_theme', $fields ) ) {
|
||||
$data['is_block_theme'] = $theme->is_block_theme();
|
||||
}
|
||||
|
||||
$data = $this->add_additional_fields_to_object( $data, $request );
|
||||
|
||||
// Wrap the data in a response object.
|
||||
@@ -494,6 +498,11 @@ class WP_REST_Themes_Controller extends WP_REST_Controller {
|
||||
),
|
||||
),
|
||||
),
|
||||
'is_block_theme' => array(
|
||||
'description' => __( 'Whether the theme is a block-based theme.' ),
|
||||
'type' => 'boolean',
|
||||
'readonly' => true,
|
||||
),
|
||||
'name' => array(
|
||||
'description' => __( 'The name of the theme.' ),
|
||||
'type' => 'object',
|
||||
|
||||
Reference in New Issue
Block a user