-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Block Bindings: Adapt block bindings to wordpress code latest changes #58383
Block Bindings: Adapt block bindings to wordpress code latest changes #58383
Conversation
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/compat/wordpress-6.5/block-bindings/class-wp-block-bindings-registry.php ❔ lib/compat/wordpress-6.5/block-bindings/block-bindings.php ❔ lib/compat/wordpress-6.5/block-bindings/sources/pattern.php ❔ lib/compat/wordpress-6.5/block-bindings/sources/post-meta.php ❔ lib/compat/wordpress-6.5/blocks.php ❔ lib/load.php |
Flaky tests detected in 9587798. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7697424598
|
lib/compat/wordpress-6.5/block-bindings/class-wp-block-bindings-registry.php
Show resolved
Hide resolved
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.
Code changes look good! I haven’t tested, but it would be great to do some additional rounds of verification with trunk after landing.
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.
Looks good to me code-wise!
I've tested it for all the blocks and found no issues.
I also tested using trunk
of wordpress-develop
. No issues either 👍 .
…#58383) * Update sources registration logic * Remove old function from pattern source * Update pattern source logic * Adapt `WP_Block_Bindings_Registry` class * Adapt block bindings methods * Override core sources in Gutenberg * Use `get_value_callback` * Move `block_bindings_replace_html` to `blocks.php` * Remove unnecessary `function_exists` checks * Load class file only if it doesn't exist * Load class before it is used
I just cherry-picked this PR to the release/17.6 branch to get it included in the next release: 6042c93 |
…#58383) * Update sources registration logic * Remove old function from pattern source * Update pattern source logic * Adapt `WP_Block_Bindings_Registry` class * Adapt block bindings methods * Override core sources in Gutenberg * Use `get_value_callback` * Move `block_bindings_replace_html` to `blocks.php` * Remove unnecessary `function_exists` checks * Load class file only if it doesn't exist * Load class before it is used
What?
This pull request brings the latest changes included in WordPress core related to block bindings:
Why?
We need the block bindings API to follow the same format and make it compatible in the Gutenberg plugin.
How?
I basically copied and paste the code from those PRs and make minor modifications to adapt it for Gutenberg.
Testing Instructions
Ensure that the existing bindings keep working as expected:
In a page
Test paragraph
Test heading
Repeat the paragraph test but using a heading.
Test button
Test image
In a template
Go to a page template, for example, and repeat the process. In this case, the blocks can't show the value of the custom fields because it depends on each page. They should show a placeholder instead.
Test pattern syncing overrides