summaryrefslogtreecommitdiffstats
path: root/wp-includes/class-wp-block-editor-context.php
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 07:56:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 07:56:49 +0000
commita415c29efee45520ae252d2aa28f1083a521cd7b (patch)
treef4ade4b6668ecc0765de7e1424f7c1427ad433ff /wp-includes/class-wp-block-editor-context.php
parentInitial commit. (diff)
downloadwordpress-a415c29efee45520ae252d2aa28f1083a521cd7b.tar.xz
wordpress-a415c29efee45520ae252d2aa28f1083a521cd7b.zip
Adding upstream version 6.4.3+dfsg1.upstream/6.4.3+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'wp-includes/class-wp-block-editor-context.php')
-rw-r--r--wp-includes/class-wp-block-editor-context.php58
1 files changed, 58 insertions, 0 deletions
diff --git a/wp-includes/class-wp-block-editor-context.php b/wp-includes/class-wp-block-editor-context.php
new file mode 100644
index 0000000..bb2d44e
--- /dev/null
+++ b/wp-includes/class-wp-block-editor-context.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * Blocks API: WP_Block_Editor_Context class
+ *
+ * @package WordPress
+ * @since 5.8.0
+ */
+
+/**
+ * Contains information about a block editor being rendered.
+ *
+ * @since 5.8.0
+ */
+#[AllowDynamicProperties]
+final class WP_Block_Editor_Context {
+ /**
+ * String that identifies the block editor being rendered. Can be one of:
+ *
+ * - `'core/edit-post'` - The post editor at `/wp-admin/edit.php`.
+ * - `'core/edit-widgets'` - The widgets editor at `/wp-admin/widgets.php`.
+ * - `'core/customize-widgets'` - The widgets editor at `/wp-admin/customize.php`.
+ * - `'core/edit-site'` - The site editor at `/wp-admin/site-editor.php`.
+ *
+ * Defaults to 'core/edit-post'.
+ *
+ * @since 6.0.0
+ *
+ * @var string
+ */
+ public $name = 'core/edit-post';
+
+ /**
+ * The post being edited by the block editor. Optional.
+ *
+ * @since 5.8.0
+ *
+ * @var WP_Post|null
+ */
+ public $post = null;
+
+ /**
+ * Constructor.
+ *
+ * Populates optional properties for a given block editor context.
+ *
+ * @since 5.8.0
+ *
+ * @param array $settings The list of optional settings to expose in a given context.
+ */
+ public function __construct( array $settings = array() ) {
+ if ( isset( $settings['name'] ) ) {
+ $this->name = $settings['name'];
+ }
+ if ( isset( $settings['post'] ) ) {
+ $this->post = $settings['post'];
+ }
+ }
+}