class-wp-block-editor-context.php (890B)
1 <?php 2 /** 3 * Blocks API: WP_Block_Editor_Context class 4 * 5 * @package WordPress 6 * @since 5.8.0 7 */ 8 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. 15 * 16 * @since 5.8.0 17 */ 18 final class WP_Block_Editor_Context { 19 /** 20 * Post being edited. Optional. 21 * 22 * @since 5.8.0 23 * 24 * @var WP_Post|null 25 */ 26 public $post = null; 27 28 /** 29 * Constructor. 30 * 31 * Populates optional properties for a given block editor context. 32 * 33 * @since 5.8.0 34 * 35 * @param array $settings The list of optional settings to expose in a given context. 36 */ 37 public function __construct( array $settings = array() ) { 38 if ( isset( $settings['post'] ) ) { 39 $this->post = $settings['post']; 40 } 41 } 42 }