Make WordPress Core


Ignore:
Timestamp:
06/29/2023 06:19:41 AM (18 months ago)
Author:
isabel_brison
Message:

Editor: update duotone support.

Updates duotone support after stabilisation of selectors API and adds a few small code quality and UI improvements.

Props onemaggie, peterwilsoncc, ajlende, audrasjb, mikeschroder, ramonopoly.
Fixes #58555.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/global-styles-and-settings.php

    r56094 r56101  
    287287
    288288    return $stylesheet;
    289 }
    290 
    291 /**
    292  * Returns a string containing the SVGs to be referenced as filters (duotone).
    293  *
    294  * @since 5.9.1
    295  *
    296  * @return string
    297  */
    298 function wp_get_global_styles_svg_filters() {
    299     /*
    300      * Ignore cache when the development mode is set to 'theme', so it doesn't interfere with the theme
    301      * developer's workflow.
    302      */
    303     $can_use_cached = wp_get_development_mode() !== 'theme';
    304     $cache_group    = 'theme_json';
    305     $cache_key      = 'wp_get_global_styles_svg_filters';
    306     if ( $can_use_cached ) {
    307         $cached = wp_cache_get( $cache_key, $cache_group );
    308         if ( $cached ) {
    309             return $cached;
    310         }
    311     }
    312 
    313     $supports_theme_json = wp_theme_has_theme_json();
    314 
    315     $origins = array( 'default', 'theme', 'custom' );
    316     if ( ! $supports_theme_json ) {
    317         $origins = array( 'default' );
    318     }
    319 
    320     $tree = WP_Theme_JSON_Resolver::get_merged_data();
    321     $svgs = $tree->get_svg_filters( $origins );
    322 
    323     if ( $can_use_cached ) {
    324         wp_cache_set( $cache_key, $svgs, $cache_group );
    325     }
    326 
    327     return $svgs;
    328289}
    329290
Note: See TracChangeset for help on using the changeset viewer.