| 1 |
<?php |
| 2 |
/** |
| 3 |
* Blocks API: WP_Block_Editor_Context class |
| 4 |
* |
| 5 |
* @package Gutenberg |
| 6 |
*/ |
| 7 |
|
| 8 |
/** |
| 9 |
* Class representing a current block editor context. |
| 10 |
* |
| 11 |
* The expectation is that block editor can have a different set |
| 12 |
* of requirements on every screen where it is used. This class |
| 13 |
* allows to define supporting settings that can be used with filters. |
| 14 |
*/ |
| 15 |
final class WP_Block_Editor_Context { |
| 16 |
/** |
| 17 |
* Post being edited. Optional. |
| 18 |
* |
| 19 |
* @var WP_Post|null |
| 20 |
*/ |
| 21 |
public $post = null; |
| 22 |
|
| 23 |
/** |
| 24 |
* Constructor. |
| 25 |
* |
| 26 |
* Populates optional properties for a given block editor context. |
| 27 |
* |
| 28 |
* @param array $settings The list of optional settings to expose in a given context. |
| 29 |
*/ |
| 30 |
public function __construct( array $settings = array() ) { |
| 31 |
if ( isset( $settings['post'] ) ) { |
| 32 |
$this->post = $settings['post']; |
| 33 |
} |
| 34 |
} |
| 35 |
} |
| 36 |
|