mirror of
git://develop.git.wordpress.org/
synced 2025-04-14 09:02:06 +02:00
Editor: Add missing class WP_Block_Editor_Context
Follow-up for [50956]. See #52920. git-svn-id: https://develop.svn.wordpress.org/trunk@50957 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
2a389ad7b7
commit
d28766f8f2
42
src/wp-includes/class-wp-block-editor-context.php
Normal file
42
src/wp-includes/class-wp-block-editor-context.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Blocks API: WP_Block_Editor_Context class
|
||||
*
|
||||
* @package WordPress
|
||||
* @since 5.8.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class representing a current block editor context.
|
||||
*
|
||||
* The expectation is that block editor can have a different set
|
||||
* of requirements on every screen where it is used. This class
|
||||
* allows to define supporting settings that can be used with filters.
|
||||
*
|
||||
* @since 5.8.0
|
||||
*/
|
||||
final class WP_Block_Editor_Context {
|
||||
/**
|
||||
* Post being edited. 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['post'] ) ) {
|
||||
$this->post = $settings['post'];
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user