Skip to content

Commit 83b9080

Browse files
committed
Editor: Set new default rendering mode for Pages.
This update updates the `page` post-type definition and sets `template-locked` as the new default rendering mode for the block editor. Props mamaduka, wildworks, joemcgill, tyb, swissspidy, audrasjb. Fixes #61811. git-svn-id: https://develop.svn.wordpress.org/trunk@59885 602fd350-edb4-49c9-b593-d223f7449a82
1 parent e784437 commit 83b9080

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

src/wp-includes/post.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ function create_initial_post_types() {
6969
)
7070
);
7171

72+
// Enhance page editor for block themes by rendering template and content blocks.
73+
if ( wp_is_block_theme() && current_theme_supports( 'block-templates' ) ) {
74+
add_post_type_support( 'page', 'editor', array( 'default-mode' => 'template-locked' ) );
75+
}
76+
7277
register_post_type(
7378
'attachment',
7479
array(

tests/phpunit/tests/option/networkOption.php

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -381,14 +381,18 @@ public function test_delete_network_option_does_not_use_network_notoptions_cache
381381
* @covers ::get_network_option
382382
*/
383383
public function test_get_network_option_does_not_use_single_site_notoptions_cache_for_networks() {
384+
$network_notoptions_cache_before = wp_cache_get( '1:notoptions', 'site-options' );
385+
$single_site_notoptions_cache_before = wp_cache_get( 'notoptions', 'options' );
386+
384387
get_network_option( 1, 'ticket_61730_notoption' );
385388

386-
$network_notoptions_cache = wp_cache_get( '1:notoptions', 'site-options' );
387-
$single_site_notoptions_cache = wp_cache_get( 'notoptions', 'options' );
389+
$network_notoptions_cache_after = wp_cache_get( '1:notoptions', 'site-options' );
390+
$single_site_notoptions_cache_after = wp_cache_get( 'notoptions', 'options' );
388391

389-
$this->assertEmpty( $single_site_notoptions_cache, 'Single site notoptions cache should not be set for multisite installs.' );
390-
$this->assertIsArray( $network_notoptions_cache, 'Multisite notoptions cache should be set.' );
391-
$this->assertArrayHasKey( 'ticket_61730_notoption', $network_notoptions_cache, 'The option should be in the notoptions cache.' );
392+
$this->assertSame( $single_site_notoptions_cache_before, $single_site_notoptions_cache_after, 'Single site notoptions cache should not change for multisite installs.' );
393+
$this->assertNotSame( $network_notoptions_cache_before, $network_notoptions_cache_after, 'Multisite notoptions cache should change.' );
394+
$this->assertIsArray( $network_notoptions_cache_after, 'Multisite notoptions cache should be set.' );
395+
$this->assertArrayHasKey( 'ticket_61730_notoption', $network_notoptions_cache_after, 'The option should be in the notoptions cache.' );
392396
}
393397

394398
/**
@@ -402,14 +406,18 @@ public function test_get_network_option_does_not_use_single_site_notoptions_cach
402406
* @covers ::delete_network_option
403407
*/
404408
public function test_delete_network_option_does_not_use_single_site_notoptions_cache_for_networks() {
409+
$network_notoptions_cache_before = wp_cache_get( '1:notoptions', 'site-options' );
410+
$single_site_notoptions_cache_before = wp_cache_get( 'notoptions', 'options' );
411+
405412
add_network_option( 1, 'ticket_61730_notoption', 'value' );
406413
delete_network_option( 1, 'ticket_61730_notoption' );
407414

408-
$network_notoptions_cache = wp_cache_get( '1:notoptions', 'site-options' );
409-
$single_site_notoptions_cache = wp_cache_get( 'notoptions', 'options' );
415+
$network_notoptions_cache_after = wp_cache_get( '1:notoptions', 'site-options' );
416+
$single_site_notoptions_cache_after = wp_cache_get( 'notoptions', 'options' );
410417

411-
$this->assertEmpty( $single_site_notoptions_cache, 'Single site notoptions cache should not be set for multisite installs.' );
412-
$this->assertIsArray( $network_notoptions_cache, 'Multisite notoptions cache should be set.' );
413-
$this->assertArrayHasKey( 'ticket_61730_notoption', $network_notoptions_cache, 'The option should be in the notoptions cache.' );
418+
$this->assertSame( $single_site_notoptions_cache_before, $single_site_notoptions_cache_after, 'Single site notoptions cache should not change for multisite installs.' );
419+
$this->assertNotSame( $network_notoptions_cache_before, $network_notoptions_cache_after, 'Multisite notoptions cache should change.' );
420+
$this->assertIsArray( $network_notoptions_cache_after, 'Multisite notoptions cache should be set.' );
421+
$this->assertArrayHasKey( 'ticket_61730_notoption', $network_notoptions_cache_after, 'The option should be in the notoptions cache.' );
414422
}
415423
}

0 commit comments

Comments
 (0)