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

Closed
Show file tree
Hide file tree
Changes from all 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
7 changes: 7 additions & 0 deletions src/wp-includes/block-template-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -475,12 +475,19 @@ function _flatten_blocks( &$blocks ) {
* stylesheet as a theme attribute into each wp_template_part
*
* @since 5.9.0
* @deprecated 6.4.0 Use traverse_and_serialize_blocks( parse_blocks( $template_content ), '_inject_theme_attribute_in_template_part_block' ) instead.
* @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',
'traverse_and_serialize_blocks( parse_blocks( $template_content ), "_inject_theme_attribute_in_template_part_block" )'
);

$has_updated_content = false;
$new_content = '';
$template_blocks = parse_blocks( $template_content );
Expand Down
7 changes: 7 additions & 0 deletions tests/phpunit/tests/block-template-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,13 @@ public function test_not_inject_theme_attribute_non_template_part_block() {
);
}

/**
* @ticket 59452
*
* @covers ::_inject_theme_attribute_in_block_template_content
*
* @expectedDeprecated _inject_theme_attribute_in_block_template_content
*/
public function test_inject_theme_attribute_in_block_template_content() {
$theme = get_stylesheet();
$content_without_theme_attribute = '<!-- wp:template-part {"slug":"header","align":"full", "tagName":"header","className":"site-header"} /-->';
Expand Down
Loading