-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duotone: Only output Duotone filters that are used #48291
Closed
Closed
Changes from 2 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
afb2547
Duotone: Only output Duotone filters that are used
scruffian 0335718
simplify
scruffian cb94566
just compare the CSS variables
scruffian c8e659a
remove unused code
scruffian f6b610a
remove unconnected change
scruffian 7e03c5d
fix linter
scruffian 117cdf3
Fix linter
scruffian 1acc298
use actions and filters to make the approach more generic
scruffian 3b06685
remove unused code
scruffian 7623952
Default static $duotone_preset to empty array
jeryj 4e1876d
Merge branch 'update/output-only-used-filters' of github.com:WordPres…
scruffian 74ae720
move the place where we output the css for the preset
scruffian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -191,3 +191,38 @@ function gutenberg_enqueue_global_styles_custom_css() { | |
} | ||
} | ||
add_action( 'wp_enqueue_scripts', 'gutenberg_enqueue_global_styles_custom_css' ); | ||
|
||
|
||
|
||
/** | ||
* Renders the SVG filters supplied by theme.json. | ||
* | ||
* Note that this doesn't render the per-block user-defined | ||
* filters which are handled by wp_render_duotone_support, | ||
* but it should be rendered before the filtered content | ||
* in the body to satisfy Safari's rendering quirks. | ||
* | ||
* @since 5.9.1 | ||
*/ | ||
function gutenberg_global_styles_render_svg_filters() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is just a copy of |
||
/* | ||
* When calling via the in_admin_header action, we only want to render the | ||
* SVGs on block editor pages. | ||
*/ | ||
if ( | ||
is_admin() && | ||
! get_current_screen()->is_block_editor() | ||
) { | ||
return; | ||
} | ||
|
||
$filters = gutenberg_get_global_styles_svg_filters(); | ||
if ( ! empty( $filters ) ) { | ||
echo $filters; | ||
} | ||
} | ||
|
||
remove_action( 'wp_body_open', 'wp_global_styles_render_svg_filters' ); | ||
remove_action( 'in_admin_header', 'wp_global_styles_render_svg_filters' ); | ||
add_action( 'wp_body_open', 'gutenberg_global_styles_render_svg_filters' ); | ||
add_action( 'in_admin_header', 'gutenberg_global_styles_render_svg_filters' ); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a copy of
gutenberg_get_global_styles_svg_filters
with the reference to theWP_Theme_JSON_Resolver
class updated toWP_Theme_JSON_Resolver_Gutenberg
.