Changeset 12025
- Timestamp:
- 08/19/2022 07:35:59 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/includes/inline-styles.php
r11766 r12025 179 179 } 180 180 181 $colors = $block['attrs']['style']['color']['duotone']; 182 $filter_key = is_array( $colors ) ? implode( '-', $colors ) : $colors; 181 183 $filter_preset = array( 182 'slug' => wp_unique_id( sanitize_key( implode( '-', $block['attrs']['style']['color']['duotone'] ). '-' ) ),183 'colors' => $ block['attrs']['style']['color']['duotone'],184 'slug' => wp_unique_id( sanitize_key( $filter_key . '-' ) ), 185 'colors' => $colors, 184 186 ); 185 187 $filter_property = wp_get_duotone_filter_property( $filter_preset ); 186 188 $filter_id = wp_get_duotone_filter_id( $filter_preset ); 187 $filter_svg = wp_get_duotone_filter_svg( $filter_preset );188 189 189 190 $scope = '.' . $filter_id; … … 201 202 : $selector . '{filter:' . $filter_property . ' !important;}'; 202 203 203 // Like the layout hook, this assumes the hook only applies to blocks with a single wrapper. 204 wp_register_style( $filter_id, false, array(), true, true ); 205 wp_add_inline_style( $filter_id, $filter_style ); 206 wp_enqueue_style( $filter_id ); 207 204 208 $content = preg_replace( 205 209 '/' . preg_quote( 'class="', '/' ) . '/', … … 209 213 ); 210 214 215 $filter_svg = ''; 216 if ( 'unset' !== $colors ) { 217 $filter_svg = wp_get_duotone_filter_svg( $filter_preset ); 218 } 219 211 220 // Output the style first, to fix the Safari bug. 212 // See https://github.com/WordPress/gutenberg/blob/ a9b29acd0a058644ef28523c00fbe633272d6c0c/lib/block-supports/duotone.php#L467.221 // See https://github.com/WordPress/gutenberg/blob/330f1f4a19603529130dbd831be824c07d50d8e8/lib/block-supports/duotone.php#L431. 213 222 return '<style>' . $filter_style . '</style>' . $filter_svg . $content; 214 223 }
Note: See TracChangeset
for help on using the changeset viewer.