Fix warnings when using Storefront or non-FSE themes (#47631)

* Fix warnings from undefined

* Changelog

* Revert the fse check since it disables the fonts from working in coming soon pages
This commit is contained in:
Ilyas Foo 2024-05-21 11:43:25 +08:00 committed by GitHub
parent 8541afa418
commit 4374617d43
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Fix warnings from using fse theme json filter

View File

@ -26,7 +26,7 @@ class ComingSoonRequestHandler {
final public function init( ComingSoonHelper $coming_soon_helper ) {
$this->coming_soon_helper = $coming_soon_helper;
add_filter( 'template_include', array( $this, 'handle_template_include' ) );
add_filter( 'wp_theme_json_data_theme', array( $this, 'filter_theme_json_theme' ) );
add_filter( 'wp_theme_json_data_theme', array( $this, 'experimental_filter_theme_json_theme' ) );
}
@ -119,13 +119,13 @@ class ComingSoonRequestHandler {
*
* @param WP_Theme_JSON $theme_json The theme json object.
*/
public function filter_theme_json_theme( $theme_json ) {
public function experimental_filter_theme_json_theme( $theme_json ) {
if ( ! Features::is_enabled( 'launch-your-store' ) ) {
return $theme_json;
}
$theme_data = $theme_json->get_data();
$font_data = $theme_data['settings']['typography']['fontFamilies']['theme'];
$font_data = $theme_data['settings']['typography']['fontFamilies']['theme'] ?? array();
$fonts_to_add = array(
array(