-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Block Bindings: Add fallback for new features introduced in Core #71389
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
Conversation
|
Flaky tests detected in 30680fe. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/17489806332
|
…rted block attributes
…est into data provider
|
Tests are copied from Core, with some additional changes made here. They are being synced back in WordPress/wordpress-develop#9748. One difference in the GB version is that I've removed the |
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
cbravobernal
left a comment
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.
Work as expected.
…dPress#71389) * Block Bindings: Add fallback * Block Bindings: Use fallback for Date block * Add backport changelog * In tests, set datetime attribute indirectly. * Extract and process context * Add test coverage for new Block Bindings features * Apply new Block Bindings logic to core/button block * Move remove_filter() from tear_down to wpTearDownAfterClass * Guard render_callback against unset attribute * Minor comment clarification * No need to add filter during setup * Massage code to look more like Core * Remove attributes that were handled by 6.8 early * Update pattern overrides test to make sure they work with newly supported block attributes * Implement support for pattern overrides in fallback * Whitespace tweaks * Update context test to make sure they work with newly supported block attributes * Add block_bindings_supported_attributes filter during setup, absorb test into data provider * Whitespace * Switch another test to test/block * Remove unnecessary source declaration * Merge context tests * Merge tests for different get_value_callbacks * Move block_bindings_supported_attributes filter to set_up() * Add PHPDoc for set_up * Remove @SInCE PHPDocs * Remove @ticket references from PHPDoc in tests * Shut up WPCS * Remove obsolete function parameter
What?
Gutenberg port of WordPress/wordpress-develop#9469 (and WordPress/wordpress-develop#9392).
Why?
For backwards compatibility.
How?
Largely by copying
WP_Block'sprocess_block_bindingsandreplace_htmlmethods (plus some tweaks to allow accessing some of itsprotectedproperties), and calling them from a filter that's hooked torender_block. Some optimizations are made to avoid running code redundantly for block attributes that are already handled by WP 6.8.Testing Instructions
Test both against Core
trunk, and6.8.Verify that block bindings and pattern override still work as before. For manual smoke testing, follow e.g. the testing instructions of the Date block.
There is ample unit test coverage, largely obtained by copying this file from Core, and some tweaks to it to make sure unit tests pass for a newly added
test/blockthat isn't present in 6.8. (Those test tweaks -- which make the unit tests a bit less verbose and redundant IMO -- are being backported to Core in WordPress/wordpress-develop#9748.)