Automattic\WooCommerce\EmailEditor\Engine
Site_Style_Sync_Controller::resolve_style_value
Styles may contain references to other styles. This function resolves the reference to the actual value. https://make.wordpress.org/core/2022/10/11/reference-styles-values-in-theme-json/ It is not allowed to reference another reference so we don't need to check recursively.
Method of the class: Site_Style_Sync_Controller{}
No Hooks.
Returns
Mixed. Resolved style value or null when the reference is not found.
Usage
// private - for code of main (parent) class only $result = $this->resolve_style_value( $style_value );
- $style_value(mixed) (required)
- Style value that might contain a reference.
Site_Style_Sync_Controller::resolve_style_value() Site Style Sync Controller::resolve style value code WC 10.5.0
private function resolve_style_value( $style_value ) {
// Check if this is a reference array.
if ( is_array( $style_value ) && isset( $style_value['ref'] ) ) {
$ref = $style_value['ref'];
if ( ! is_string( $ref ) || empty( $ref ) ) {
return null;
}
$path = explode( '.', $ref );
return _wp_array_get( $this->get_site_theme()->get_data(), $path, null );
}
return $style_value;
}