From c322865d58ce61e5c62804e266ee29e06be1f6f3 Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Mon, 21 Sep 2020 14:36:56 +0300 Subject: [PATCH] Add 3 filters for global styles --- lib/global-styles.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/lib/global-styles.php b/lib/global-styles.php index 10180161342fb1..d394964a059a0d 100644 --- a/lib/global-styles.php +++ b/lib/global-styles.php @@ -411,7 +411,7 @@ function gutenberg_experimental_global_styles_get_support_keys() { * @return array Presets structure */ function gutenberg_experimental_global_styles_get_presets_structure() { - return array( + $structure = array( 'color' => array( 'path' => array( 'color', 'palette' ), 'key' => 'color', @@ -425,6 +425,13 @@ function gutenberg_experimental_global_styles_get_presets_structure() { 'key' => 'size', ), ); + + /** + * Filter the global styles presets structure. + * + * @param array $structure The structure array. + */ + return apply_filters( 'global_styles_get_presets_structure', $structure ); } /** @@ -531,7 +538,12 @@ function gutenberg_experimental_global_styles_get_block_data() { } } - return $block_data; + /** + * Filter the global styles array for blocks. + * + * @param array $block_data The block-data array. + */ + return apply_filters( 'global_styles_get_block_data', $block_data ); } /** @@ -617,7 +629,12 @@ function gutenberg_experimental_global_styles_get_stylesheet( $tree ) { $stylesheet .= 'a{color:var(--wp--style--color--link, #00e);}'; } - return $stylesheet; + /** + * Filter the generated styles. + * + * @param string $stylesheet The generated CSS. + */ + return apply_filters( 'global_styles_get_stylesheet', $stylesheet ); } /**