Takes the inline CSS duotone variable from a block and return the slug.
Description
Handles styles slugs like: var:preset|duotone|blue-orange var(–wp–preset–duotone–blue-orange)
Parameters
$duotone_attr
stringrequired- The duotone attribute from a block.
Source
private static function get_slug_from_attribute( $duotone_attr ) {
// Uses Branch Reset Groups `(?|…)` to return one capture group.
preg_match( '/(?|var:preset\|duotone\|(\S+)|var\(--wp--preset--duotone--(\S+)\))/', $duotone_attr, $matches );
return ! empty( $matches[1] ) ? $matches[1] : '';
}
Changelog
Version | Description |
---|---|
6.3.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.