mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
Site Editor: Revert r54860.
[54860] caused a regression. Changes to a parent theme's template part (i.e.e when a child theme does not override that template part) no longer saved in the Site Editor. Reverting the changeset resolves the regression. Props mreishus, hellofromTonya, azaozz, ironprogrammer, antonvlasenko. Fixes #57630. See #55437. git-svn-id: https://develop.svn.wordpress.org/trunk@55493 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -503,7 +503,7 @@ function _build_block_template_result_from_file( $template_file, $template_type
|
||||
|
||||
$template = new WP_Block_Template();
|
||||
$template->id = $theme . '//' . $template_file['slug'];
|
||||
$template->theme = ! empty( $template_file['theme'] ) ? $template_file['theme'] : $theme;
|
||||
$template->theme = $theme;
|
||||
$template->content = _inject_theme_attribute_in_block_template_content( $template_content );
|
||||
$template->slug = $template_file['slug'];
|
||||
$template->source = 'theme';
|
||||
|
||||
@@ -119,25 +119,6 @@ class Tests_Block_Template_Utils extends WP_UnitTestCase {
|
||||
$this->assertSame( WP_TEMPLATE_PART_AREA_HEADER, $template_part->area );
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that _build_block_template_result_from_post() returns the correct theme
|
||||
* for the template when a child theme is active.
|
||||
*
|
||||
* @ticket 55437
|
||||
*
|
||||
* @covers ::_build_block_template_result_from_post
|
||||
*/
|
||||
public function test_build_block_template_result_from_post_with_child_theme() {
|
||||
switch_theme( 'block-theme-child' );
|
||||
|
||||
$template = _build_block_template_result_from_post(
|
||||
self::$template_post,
|
||||
'wp_template'
|
||||
);
|
||||
|
||||
$this->assertSame( self::TEST_THEME, $template->theme );
|
||||
}
|
||||
|
||||
public function test_build_block_template_result_from_file() {
|
||||
$template = _build_block_template_result_from_file(
|
||||
array(
|
||||
@@ -176,29 +157,6 @@ class Tests_Block_Template_Utils extends WP_UnitTestCase {
|
||||
$this->assertSame( WP_TEMPLATE_PART_AREA_HEADER, $template_part->area );
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that _build_block_template_result_from_file() returns the correct theme
|
||||
* for the template when a child theme is active.
|
||||
*
|
||||
* @ticket 55437
|
||||
*
|
||||
* @covers ::_build_block_template_result_from_file
|
||||
*/
|
||||
public function test_build_block_template_result_from_file_with_child_theme() {
|
||||
switch_theme( 'block-theme-child' );
|
||||
|
||||
$template = _build_block_template_result_from_file(
|
||||
array(
|
||||
'slug' => 'single',
|
||||
'path' => __DIR__ . '/../data/templates/template.html',
|
||||
'theme' => self::TEST_THEME,
|
||||
),
|
||||
'wp_template'
|
||||
);
|
||||
|
||||
$this->assertSame( self::TEST_THEME, $template->theme );
|
||||
}
|
||||
|
||||
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"} /-->';
|
||||
|
||||
Reference in New Issue
Block a user