Automattic\WooCommerce\EmailEditor\Engine
Theme_Controller::get_variables_values_map
Returns the map of CSS variables and their values from the theme.
Method of the class: Theme_Controller{}
No Hooks.
Returns
Array.
Usage
$Theme_Controller = new Theme_Controller(); $Theme_Controller->get_variables_values_map(): array;
Theme_Controller::get_variables_values_map() Theme Controller::get variables values map code WC 10.7.0
public function get_variables_values_map(): array {
$variables_css = $this->get_theme()->get_stylesheet( array( 'variables' ) );
$map = array();
// Regular expression to match CSS variable definitions.
$pattern = '/--(.*?):\s*(.*?);/';
if ( preg_match_all( $pattern, $variables_css, $matches, PREG_SET_ORDER ) ) {
foreach ( $matches as $match ) {
// '--' . $match[1] is the variable name, $match[2] is the variable value.
$map[ '--' . $match[1] ] = $match[2];
}
}
return $map;
}