Changeset 52942
- Timestamp:
- 03/17/2022 03:35:13 AM (3 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/site-editor.php
r52593 r52942 50 50 } 51 51 52 $block_editor_context = new WP_Block_Editor_Context( );52 $block_editor_context = new WP_Block_Editor_Context( array( 'name' => 'core/edit-site' ) ); 53 53 $custom_settings = array( 54 54 'siteUrl' => site_url(), -
trunk/src/wp-admin/widgets-form-blocks.php
r51962 r52942 16 16 $current_screen->is_block_editor( true ); 17 17 18 $block_editor_context = new WP_Block_Editor_Context( );18 $block_editor_context = new WP_Block_Editor_Context( array( 'name' => 'core/edit-widgets' ) ); 19 19 20 20 $preload_paths = array( -
trunk/src/wp-includes/class-wp-block-editor-context.php
r50957 r52942 8 8 9 9 /** 10 * Class representing a current block editor context. 11 * 12 * The expectation is that block editor can have a different set 13 * of requirements on every screen where it is used. This class 14 * allows to define supporting settings that can be used with filters. 10 * Contains information about a block editor being rendered. 15 11 * 16 12 * @since 5.8.0 … … 18 14 final class WP_Block_Editor_Context { 19 15 /** 20 * Post being edited. Optional. 16 * String that identifies the block editor being rendered. Can be one of: 17 * 18 * - `'core/edit-post'` - The post editor at `/wp-admin/edit.php`. 19 * - `'core/edit-widgets'` - The widgets editor at `/wp-admin/widgets.php`. 20 * - `'core/customize-widgets'` - The widgets editor at `/wp-admin/customize.php`. 21 * - `'core/edit-site'` - The site editor at `/wp-admin/site-editor.php`. 22 * 23 * Defaults to 'core/edit-post'. 24 * 25 * @since 6.0.0 26 * 27 * @var string 28 */ 29 public $name = 'core/edit-post'; 30 31 /** 32 * The post being edited by the block editor. Optional. 21 33 * 22 34 * @since 5.8.0 … … 36 48 */ 37 49 public function __construct( array $settings = array() ) { 50 if ( isset( $settings['name'] ) ) { 51 $this->name = $settings['name']; 52 } 38 53 if ( isset( $settings['post'] ) ) { 39 54 $this->post = $settings['post']; -
trunk/src/wp-includes/class-wp-customize-widgets.php
r52622 r52942 839 839 840 840 if ( wp_use_widgets_block_editor() ) { 841 $block_editor_context = new WP_Block_Editor_Context(); 841 $block_editor_context = new WP_Block_Editor_Context( 842 array( 843 'name' => 'core/customize-widgets', 844 ) 845 ); 842 846 843 847 $editor_settings = get_block_editor_settings( -
trunk/tests/phpunit/tests/blocks/editor.php
r52349 r52942 81 81 $context = new WP_Block_Editor_Context(); 82 82 83 $this->assertSame( 'core/edit-post', $context->name ); 83 84 $this->assertNull( $context->post ); 84 85 } … … 90 91 $context = new WP_Block_Editor_Context( array( 'post' => get_post() ) ); 91 92 93 $this->assertSame( 'core/edit-post', $context->name ); 92 94 $this->assertSame( get_post(), $context->post ); 95 } 96 97 /** 98 * @ticket 55301 99 */ 100 public function test_block_editor_context_widgets() { 101 $context = new WP_Block_Editor_Context( array( 'name' => 'core/edit-widgets' ) ); 102 103 $this->assertSame( 'core/edit-widgets', $context->name ); 104 $this->assertNull( $context->post ); 105 } 106 107 /** 108 * @ticket 55301 109 */ 110 public function test_block_editor_context_widgets_customizer() { 111 $context = new WP_Block_Editor_Context( array( 'name' => 'core/customize-widgets' ) ); 112 113 $this->assertSame( 'core/customize-widgets', $context->name ); 114 $this->assertNull( $context->post ); 115 } 116 117 /** 118 * @ticket 55301 119 */ 120 public function test_block_editor_context_site() { 121 $context = new WP_Block_Editor_Context( array( 'name' => 'core/edit-site' ) ); 122 123 $this->assertSame( 'core/edit-site', $context->name ); 124 $this->assertNull( $context->post ); 93 125 } 94 126
Note: See TracChangeset
for help on using the changeset viewer.