This is used to convert the internal representation of variables to the CSS representation.
Description
For example, var:preset|color|vivid-green-cyan becomes var(--wp--preset--color--vivid-green-cyan).
Parameters
$valuestringrequired- The variable such as var:
preset|color|vivid-green-cyan to convert.
Source
private static function convert_custom_properties( $value ) {
$prefix = 'var:';
$prefix_len = strlen( $prefix );
$token_in = '|';
$token_out = '--';
if ( str_starts_with( $value, $prefix ) ) {
$unwrapped_name = str_replace(
$token_in,
$token_out,
substr( $value, $prefix_len )
);
$value = "var(--wp--$unwrapped_name)";
}
return $value;
}
Changelog
| Version | Description |
|---|---|
| 6.3.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.