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

Backport 59764 Add filter for duotone to account for gutenberg_restore_image_outer_container in classic themes #6719

Closed
wants to merge 3 commits into from

Conversation

ajlende
Copy link

@ajlende ajlende commented Jun 3, 2024

Backport for WordPress/gutenberg#59764

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


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.

Copy link

github-actions bot commented Jun 3, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props ajlende.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link

github-actions bot commented Jun 3, 2024

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

These imports cause side-effects with filters, so they should be in the same order in both places to avoid issues
Copy link
Author

Choose a reason for hiding this comment

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

From WordPress/gutenberg#59764 (comment)

So with the plugin active, both Gutenberg layout hook and the new duotone hook should be running. The duotone one runs after the layout one because of the order they're defined in

https://github.com/WordPress/gutenberg/blob/d7e80e65440fa019da8657e9e7d5b85a0dc45682/lib/load.php#L210

When this gets backported to core, the same should happen with the core version of the functions. Although, it looks like the imports will have to be reordered during the core backport (WordPress/wordpress-develop@9a616a5/src/wp-settings.php#L371).

In my opinion, with the way WordPress code is written with side effects in many files, the way that we mostly centralize imports, the size of the codebase, and the number of contributors, it makes more sense for use to just preserve the order of imports when backporting things to not have to worry so much about priority levels. It seems better to me to maintain that order than force extenders to use extra high priorities to override core behavior.

Copy link
Contributor

Choose a reason for hiding this comment

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

This makes sense. Do we know why they were added to core in a different order in the first place?

We'll need to test that all these supports combined are still working as expected on this PR.

Copy link
Contributor

@tellthemachines tellthemachines left a comment

Choose a reason for hiding this comment

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

I've tested the reordered block supports with both a classic and a block theme and there don't seem to be any changes.
The duotone filter is working as expected with aligned images on classic themes.
There are no changes for aligned images on block themes.

Code LGTM!

Given how close we are to Beta 1 I think it's OK to commit this as is but as a follow-up it would be nice to add a unit test for the new function

@tellthemachines
Copy link
Contributor

Committed in r58313.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants