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

Button Block: Add back compat for WP6.4 regarding HTML Tag Processor #63082

Merged
merged 5 commits into from
Jul 4, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion packages/block-library/src/button/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,15 @@
* @return string The block content.
*/
function render_block_core_button( $attributes, $content ) {
$p = new WP_HTML_Tag_Processor( $content );
/*
* The current Gutenberg plugin supports WordPress 6.4, but the next_token()
* method does not exist in WordPress 6.4. Therefore, use the Gutenberg
* class that has the `next_token()` method.
*
* TODO: After the Gutenberg plugin drops support for WordPress 6.4, this
* class should be replaced with `WP_HTML_Tag_Processor`.
*/
$p = new Gutenberg_HTML_Tag_Processor_6_5( $content ); // phpcs:ignore Gutenberg.CodeAnalysis.ForbiddenFunctionsAndClasses.ForbiddenClassUsage
t-hamano marked this conversation as resolved.
Show resolved Hide resolved
t-hamano marked this conversation as resolved.
Show resolved Hide resolved

/*
* The button block can render an `<a>` or `<button>` and also has a
Expand Down
Loading