Scrape all possible duotone presets from global and theme styles and store them in self::$global_styles_presets.
Description
Used in conjunction with self::render_duotone_support for blocks that use duotone preset filters.
Source
private static function get_all_global_styles_presets() {
if ( isset( self::$global_styles_presets ) ) {
return self::$global_styles_presets;
}
// Get the per block settings from the theme.json.
$tree = wp_get_global_settings();
$presets_by_origin = isset( $tree['color']['duotone'] ) ? $tree['color']['duotone'] : array();
self::$global_styles_presets = array();
foreach ( $presets_by_origin as $presets ) {
foreach ( $presets as $preset ) {
$filter_id = self::get_filter_id( _wp_to_kebab_case( $preset['slug'] ) );
self::$global_styles_presets[ $filter_id ] = $preset;
}
}
return self::$global_styles_presets;
}
Changelog
Version | Description |
---|---|
6.3.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.