Changeset 61603 for trunk/src/wp-includes/class-wp-duotone.php
- Timestamp:
- 02/09/2026 05:08:13 PM (4 months ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/class-wp-duotone.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-duotone.php
r61457 r61603 547 547 * @since 6.3.0 548 548 * 549 * @param string $duotone_attr The duotone attribute from a block.550 * @return string The slug of the duotone preset or an empty string if no slug is found .549 * @param string|string[] $duotone_attr The duotone attribute from a block. 550 * @return string The slug of the duotone preset or an empty string if no slug is found (including when an array was passed). 551 551 */ 552 552 private static function get_slug_from_attribute( $duotone_attr ) { 553 if ( ! is_string( $duotone_attr ) ) { 554 return ''; 555 } 556 553 557 // Uses Branch Reset Groups `(?|…)` to return one capture group. 554 558 preg_match( '/(?|var:preset\|duotone\|(\S+)|var\(--wp--preset--duotone--(\S+)\))/', $duotone_attr, $matches ); … … 567 571 * 568 572 * @param string $duotone_attr The duotone attribute from a block. 569 * @ return bool True if the duotone preset present and valid.573 * @param string|string[] $duotone_attr The duotone attribute from a block. 570 574 */ 571 575 private static function is_preset( $duotone_attr ) { 576 if ( ! is_string( $duotone_attr ) ) { 577 return false; 578 } 579 572 580 $slug = self::get_slug_from_attribute( $duotone_attr ); 573 581 $filter_id = self::get_filter_id( $slug ); … … 1051 1059 } 1052 1060 // If it has a duotone filter preset, save the block name and the preset slug. 1061 // Only process if it's a string (preset reference), not an array (custom colors). 1062 if ( ! is_string( $duotone_attr ) ) { 1063 continue; 1064 } 1065 1053 1066 $slug = self::get_slug_from_attribute( $duotone_attr ); 1054 1067
Note: See TracChangeset
for help on using the changeset viewer.