Skip to content

Backport Duotone fixes for 5.9.1#2326

Closed
Mamaduka wants to merge 14 commits into
WordPress:trunkfrom
Mamaduka:backport/duotone-5.9
Closed

Backport Duotone fixes for 5.9.1#2326
Mamaduka wants to merge 14 commits into
WordPress:trunkfrom
Mamaduka:backport/duotone-5.9

Conversation

@Mamaduka
Copy link
Copy Markdown
Member

This is a backporting patch for the following Gutenberg PRs:

Props @ajlende, @scruffian

Trac ticket: https://core.trac.wordpress.org/ticket/55179


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

Comment on lines +595 to +611
/**
* Render 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 in the same location as those to satisfy
* Safari's rendering quirks.
*
* @since 5.9.0
*/
function wp_global_styles_render_svg_filters() {
$filters = wp_get_global_styles_svg_filters();
if ( ! empty( $filters ) ) {
echo $filters;
}
}
add_action( 'wp_body_open', 'wp_global_styles_render_svg_filters' );
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

For some reason the SVG filters are not rendering in the post-editor for me as if wp_body_open() is not being called. It works fine when viewing the post. Testing with TwentyTwentyTwo with the following added to the theme.json.

{
    "styles": {
        "blocks": {
            "core/image": {
                "filter": {
                    "duotone": "var(--wp--preset--duotone--primary-and-secondary)"
                }
            }
        }
    }
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The wp_body_open is template action. I don't think it's called or should be called in Dashboard.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hmm. It was being called with this setup back when I wrote that code. We'll have to find a similar action that gets called in <body> before everything else, then

Comment thread src/wp-includes/block-supports/duotone.php
Comment thread src/wp-includes/block-supports/duotone.php
Comment thread src/wp-includes/block-supports/duotone.php Outdated
Comment thread src/wp-includes/block-supports/duotone.php Outdated
Comment thread src/wp-includes/block-supports/duotone.php Outdated
Comment thread src/wp-includes/block-supports/duotone.php Outdated
Comment thread src/wp-includes/block-supports/duotone.php
Comment thread src/wp-includes/block-supports/duotone.php Outdated
Comment thread src/wp-includes/block-supports/duotone.php
Comment thread src/wp-includes/class-wp-theme-json.php Outdated
Comment thread src/wp-includes/global-styles-and-settings.php Outdated
Mamaduka and others added 10 commits February 17, 2022 08:04
Co-authored-by: Tonya Mork <tonya.mork@automattic.com>
Co-authored-by: Tonya Mork <tonya.mork@automattic.com>
Co-authored-by: Tonya Mork <tonya.mork@automattic.com>
Co-authored-by: Tonya Mork <tonya.mork@automattic.com>
Co-authored-by: Tonya Mork <tonya.mork@automattic.com>
Co-authored-by: Tonya Mork <tonya.mork@automattic.com>
Co-authored-by: Tonya Mork <tonya.mork@automattic.com>
Co-authored-by: Tonya Mork <tonya.mork@automattic.com>
@Mamaduka
Copy link
Copy Markdown
Member Author

@ajlende created PR on my fork that contains a much-requested feature, allowing users to disable Duotone - Mamaduka#12.

@audrasjb
Copy link
Copy Markdown
Contributor

@audrasjb audrasjb closed this Feb 17, 2022
@Mamaduka Mamaduka deleted the backport/duotone-5.9 branch April 7, 2022 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants