Block Editor: Synchronize global styles endpoint code with Gutenberg.

This adds a missing fallback to ensure styles property is always defined in the returned data.

Props gziolo.
See #55505.


git-svn-id: https://develop.svn.wordpress.org/trunk@53075 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Riad Benguella
2022-04-05 11:47:14 +00:00
parent b8382dfe92
commit 639e3180d3
@@ -582,9 +582,7 @@ class WP_REST_Global_Styles_Controller extends WP_REST_Controller {
if ( rest_is_field_included( 'styles', $fields ) ) {
$raw_data = $theme->get_raw_data();
if ( isset( $raw_data['styles'] ) ) {
$data['styles'] = $raw_data['styles'];
}
$data['styles'] = isset( $raw_data['styles'] ) ? $raw_data['styles'] : array();
}
$context = ! empty( $request['context'] ) ? $request['context'] : 'view';