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

Elements: Deprecate old block support filter callbacks #59538

Merged
merged 6 commits into from
Apr 22, 2024

Conversation

aaronrobertshaw
Copy link
Contributor

@aaronrobertshaw aaronrobertshaw commented Mar 4, 2024

Addresses: #59535 (comment)

What?

  • Deprecates remove block support filter callback function
  • Deprecates argument for callback function that was moved to a different filter
  • Fixes some code style issues

Why?

Whether the callback functions were part of a private API and not documented publicly or not, if it could be used, it might have been so better to deprecate the function or argument as required.

How?

  • Deprecates gutenberg_render_elements_support
  • Deprecates string value for first argument for gutenberg_render_elements_support_styles (now it is used with render_block_data the arg should be an array).
  • Fixes some code style issues

Testing Instructions

  1. Run unit tests: npm run test:unit:php:base -- --filter WP_Block_Supports_Elements_Test
  2. Test element styles can still be applied and rendered correctly on the frontend following the steps over on Elements: Merge element style and classname generation to single filter #59535.

Next Steps

@aaronrobertshaw aaronrobertshaw added [Type] Code Quality Issues or PRs that relate to code quality [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Feature] Colors Color management labels Mar 4, 2024
@aaronrobertshaw aaronrobertshaw self-assigned this Mar 4, 2024
Copy link

github-actions bot commented Mar 4, 2024

This pull request changed or added PHP files in previous commits, but none have been detected in the latest commit.

Thank you! ❤️

@aaronrobertshaw
Copy link
Contributor Author

I'll be AFK for just over a week, so my connection and bandwidth might be limited in addressing any feedback until the middle of next week.

Copy link

github-actions bot commented Mar 14, 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.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: aaronrobertshaw <[email protected]>
Co-authored-by: andrewserong <[email protected]>
Co-authored-by: peterwilsoncc <[email protected]>

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

Copy link
Contributor

@andrewserong andrewserong left a comment

Choose a reason for hiding this comment

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

Thanks for the follow-up! The elements styles are still being output correctly, and the deprecated calls all look good to me. I'm not super confident with my understanding of PHP deprecated calls, though, so it might be worth getting a second opinion from @peterwilsoncc, but overall this LGTM!

@peterwilsoncc
Copy link
Contributor

Acknowledging I've seen this but I'm ignoring anything that isn't going to hit WordPress 6.5 until after the release.

Copy link
Contributor

@peterwilsoncc peterwilsoncc left a comment

Choose a reason for hiding this comment

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

This looks good to me folks, just a minor note about a self referential deprecation notice.

Once that's fixed, this is good to merge.

* @return string Filtered block content.
*/
function gutenberg_render_elements_support( $block_content ) {
_deprecated_function( __FUNCTION__, '6.6.0', 'gutenberg_render_elements_support' );
Copy link
Contributor

Choose a reason for hiding this comment

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

This refers to itself as the replacement in the third param.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching that @peterwilsoncc! 🙈

I've fixed it and the docblock in 92ebee5

@aaronrobertshaw aaronrobertshaw merged commit c817886 into trunk Apr 22, 2024
61 checks passed
@aaronrobertshaw aaronrobertshaw deleted the fix/element-block-support-filters-clean-up branch April 22, 2024 00:30
@github-actions github-actions bot added this to the Gutenberg 18.3 milestone Apr 22, 2024
@aaronrobertshaw
Copy link
Contributor Author

The changes from this PR and #59535 are combined in a single backport available in WordPress/wordpress-develop#6214.

@aaronrobertshaw aaronrobertshaw added the Backported to WP Core Pull request that has been successfully merged into WP Core label May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backported to WP Core Pull request that has been successfully merged into WP Core [Feature] Colors Color management [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants