Skip to content
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: Backport from Core to fix filters in classic themes #54778

Merged
merged 2 commits into from
Nov 20, 2023

Conversation

t-hamano
Copy link
Contributor

Fixes #54099
Related Core PR: WordPress/wordpress-develop#4839

What?

This PR applies the Duotone filter fix in the Classic theme committed in Core to the Gutenberg plugin.

Why?

Without this PR, the Dutone filter will not be applied to Classic themes when the Gutenberg plugin is activated, as reported in #54099.

How?

I applied the changes made in the core as is.

Testing Instructions

Verify that the image block duotone filter works in both block and classic themes.

@t-hamano t-hamano added [Feature] Colors Color management Backport from WordPress Core Pull request that needs to be backported to a Gutenberg release from WordPress Core labels Sep 25, 2023
@github-actions
Copy link

This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress.

If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged.

If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack.

Thank you! ❤️

View changed files
❔ lib/class-wp-duotone-gutenberg.php

wp_add_inline_style( $style_tag_id, self::get_global_styles_presets( self::$used_global_styles_presets ) );
}
if ( ! empty( self::$block_css_declarations ) ) {
wp_add_inline_style( $style_tag_id, wp_style_engine_get_stylesheet_from_css_rules( self::$block_css_declarations ) );
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the prefix of wp_style_engine_get_stylesheet_from_css_rules() function be changed to gutenberg_?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the prefix of wp_style_engine_get_stylesheet_from_css_rules() function be changed to gutenberg_?

Yeah, the gutenberg_ prefixed functions should be preferred over the wp_ ones if they exist in the plugin. This way we're testing the changes to those functions everywhere within the plugin. That way issues are much more likely to surface before porting things to core.

@t-hamano t-hamano marked this pull request as ready for review September 25, 2023 09:26
@t-hamano t-hamano self-assigned this Sep 25, 2023
@nderambure
Copy link

Hello !
Any news about this ?

Side question : now that duotone is part of block rendering, and no more in global styles, how do we force the ouput of SVGs to user Duotone outside the content of a post. I was just applying filter: url('#wp-duotone-accent3-to-accent4'); to some img tags, but it does not work anymore.

Thx !

@bph bph added the [Type] Bug An existing feature does not function as intended label Nov 16, 2023
Copy link

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Type-related labels to choose from: [Type] Automated Testing, [Type] Breaking Change, [Type] Bug, [Type] Build Tooling, [Type] Code Quality, [Type] Copy, [Type] Developer Documentation, [Type] Enhancement, [Type] Experimental, [Type] Feature, [Type] New API, [Type] Task, [Type] Performance, [Type] Project Management, [Type] Regression, [Type] Security, [Type] WP Core Ticket, Backport from WordPress Core.
  • Labels found: [Type] Bug, [Feature] Colors, Backport from WordPress Core.

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

@ajlende ajlende force-pushed the fix/backport-core-duotone branch from b5c1e1f to d633540 Compare November 20, 2023 17:53
Copy link
Contributor

@ajlende ajlende left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @t-hamano! Sorry for the delay on the review—I got really busy for a while and forgot about this one.

I've rebased with trunk, made the gutenberg_ prefix change, and tested the whole thing. It looks good to me. 👍

@ajlende ajlende enabled auto-merge (squash) November 20, 2023 18:04
@ajlende ajlende merged commit 0253471 into trunk Nov 20, 2023
48 of 49 checks passed
@ajlende ajlende deleted the fix/backport-core-duotone branch November 20, 2023 18:23
@github-actions github-actions bot added this to the Gutenberg 17.2 milestone Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backport from WordPress Core Pull request that needs to be backported to a Gutenberg release from WordPress Core [Feature] Colors Color management [Type] Bug An existing feature does not function as intended
Projects
Development

Successfully merging this pull request may close these issues.

Duotone filters are missing from live site when used in Classic Themes
4 participants