Automattic\WooCommerce\EmailEditor\Engine
Site_Style_Sync_Controller::get_site_theme
Get site theme data
Method of the class: Site_Style_Sync_Controller{}
Hooks from the method
Returns
WP_Theme_JSON.
Usage
// private - for code of main (parent) class only $result = $this->get_site_theme(): WP_Theme_JSON;
Site_Style_Sync_Controller::get_site_theme() Site Style Sync Controller::get site theme code WC 10.7.0
private function get_site_theme(): WP_Theme_JSON {
if ( null === $this->site_theme ) {
// Get only the theme and user customizations (e.g. from site editor).
$this->site_theme = new WP_Theme_JSON();
$this->site_theme->merge( WP_Theme_JSON_Resolver::get_theme_data() );
$this->site_theme->merge( WP_Theme_JSON_Resolver::get_user_data() );
/**
* Filter the site theme data used for email style sync.
*
* This filter allows overriding the site theme used when syncing global styles
* for the email editor. Useful for environments where theme data is not directly
* accessible (e.g., wp.com Atomic and Jetpack sites).
*
* @since 2.3.0
*
* @param WP_Theme_JSON $site_theme The site theme data.
*/
$this->site_theme = apply_filters( 'woocommerce_email_editor_site_theme', $this->site_theme );
if ( isset( $this->site_theme->get_raw_data()['styles'] ) ) {
$this->site_theme = WP_Theme_JSON::resolve_variables( $this->site_theme );
}
}
return $this->site_theme;
}