author | ymh <ymh.work@gmail.com> |
Mon, 08 Sep 2025 19:44:41 +0200 | |
changeset 23 | 417f20492bf7 |
parent 21 | 48c4eec2b7e6 |
permissions | -rw-r--r-- |
18 | 1 |
<?php |
2 |
/** |
|
3 |
* Blocks API: WP_Block_Editor_Context class |
|
4 |
* |
|
5 |
* @package WordPress |
|
6 |
* @since 5.8.0 |
|
7 |
*/ |
|
8 |
||
9 |
/** |
|
19 | 10 |
* Contains information about a block editor being rendered. |
18 | 11 |
* |
12 |
* @since 5.8.0 |
|
13 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
14 |
#[AllowDynamicProperties] |
18 | 15 |
final class WP_Block_Editor_Context { |
16 |
/** |
|
19 | 17 |
* String that identifies the block editor being rendered. Can be one of: |
18 |
* |
|
19 |
* - `'core/edit-post'` - The post editor at `/wp-admin/edit.php`. |
|
20 |
* - `'core/edit-widgets'` - The widgets editor at `/wp-admin/widgets.php`. |
|
21 |
* - `'core/customize-widgets'` - The widgets editor at `/wp-admin/customize.php`. |
|
22 |
* - `'core/edit-site'` - The site editor at `/wp-admin/site-editor.php`. |
|
23 |
* |
|
24 |
* Defaults to 'core/edit-post'. |
|
25 |
* |
|
26 |
* @since 6.0.0 |
|
27 |
* |
|
28 |
* @var string |
|
29 |
*/ |
|
30 |
public $name = 'core/edit-post'; |
|
31 |
||
32 |
/** |
|
33 |
* The post being edited by the block editor. Optional. |
|
18 | 34 |
* |
35 |
* @since 5.8.0 |
|
36 |
* |
|
37 |
* @var WP_Post|null |
|
38 |
*/ |
|
39 |
public $post = null; |
|
40 |
||
41 |
/** |
|
42 |
* Constructor. |
|
43 |
* |
|
44 |
* Populates optional properties for a given block editor context. |
|
45 |
* |
|
46 |
* @since 5.8.0 |
|
47 |
* |
|
48 |
* @param array $settings The list of optional settings to expose in a given context. |
|
49 |
*/ |
|
50 |
public function __construct( array $settings = array() ) { |
|
19 | 51 |
if ( isset( $settings['name'] ) ) { |
52 |
$this->name = $settings['name']; |
|
53 |
} |
|
18 | 54 |
if ( isset( $settings['post'] ) ) { |
55 |
$this->post = $settings['post']; |
|
56 |
} |
|
57 |
} |
|
58 |
} |