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

Templates: Deprecate _inject_theme_attribute_in_block_template_content(). #5307

Conversation

ockham
Copy link
Contributor

@ockham ockham commented Sep 26, 2023

I'd like to deprecate _inject_theme_attribute_in_block_template_content(), as it can be replaced by using _inject_theme_attribute_in_template_part_block() in combination with traverse_and_serialize_blocks() on the parsed template blocks instead. Note that the function has always had @access private set in its PHPDoc.

The only code in Core that it's called from is synced from Gutenberg (dynamic blocks' PHP code).

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


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.

@ockham ockham self-assigned this Sep 26, 2023
@ockham ockham requested a review from gziolo September 26, 2023 12:15
@ockham ockham marked this pull request as ready for review September 26, 2023 12:15
Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

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

It makes perfect sense 👍🏻

Thank you for working on it.

* @access private
*
* @param string $template_content serialized wp_template content.
* @return string Updated 'wp_template' content.
*/
function _inject_theme_attribute_in_block_template_content( $template_content ) {
_deprecated_function( __FUNCTION__, '6.4.0' );
Copy link
Member

Choose a reason for hiding this comment

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

I think you can also put the message with the new recommendation as 3rd argument in the call.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ockham ockham changed the title Templates: Deprecate _inject_theme_attribute_in_template_part_block(). Templates: Deprecate _inject_theme_attribute_in_block_template_content(). Sep 26, 2023
@ockham
Copy link
Contributor Author

ockham commented Sep 26, 2023

Committed to Core in https://core.trac.wordpress.org/changeset/56719.

@ockham ockham closed this Sep 26, 2023
@ockham ockham deleted the deprecate/inject-theme-attribute-in-block-template-content branch September 26, 2023 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants