WP_Style_Engine::get_slug_from_preset_value() – Util: Extracts the slug in kebab case from a preset string, e.g., "heavenly-blue" from ‘var:preset|color|heavenlyBlue’.
You appear to be a bot. Output may be restricted
Description
Util: Extracts the slug in kebab case from a preset string, e.g., "heavenly-blue" from 'var:preset|color|heavenlyBlue'.
Usage
$string = WP_Style_Engine::get_slug_from_preset_value( $style_value, $property_key );
Parameters
- $style_value
- ( string ) required – A single CSS preset value.
- $property_key
- ( string ) required – The CSS property that is the second element of the preset string. Used for matching.
Returns
string The slug, or empty string if not found.
Source
File name: wordpress/wp-includes/style-engine/class-wp-style-engine.php
Lines:
1 to 8 of 8
protected static function get_slug_from_preset_value( $style_value, $property_key ) { if ( is_string( $style_value ) && is_string( $property_key ) && str_contains( $style_value, "var:preset|{$property_key}|" ) ) { $index_to_splice = strrpos( $style_value, '|' ) + 1; return _wp_to_kebab_case( substr( $style_value, $index_to_splice ) ); } return ''; }