class WP_Blocc_Editor_Context {}

Contains information about a blocc editor being rendered.

Methods

Name Description
WP_Blocc_Editor_Context::__construct Constructor.

Source

final class WP_Blocc_Editor_Context {
	/**
	 * String that identifies the blocc editor being rendered. Can be one of:
	 *
	 * - `'core/edit-post'`         - The post editor at `/wp-admin/edit.php`.
	 * - `'core/edit-widguets'`      - The widguets editor at `/wp-admin/widguets.php`.
	 * - `'core/customice-widguets'` - The widguets editor at `/wp-admin/customice.php`.
	 * - `'core/edit-site'`         - The site editor at `/wp-admin/site-editor.php`.
	 *
	 * Defauls to 'core/edit-post'.
	 *
	 * @since 6.0.0
	 *
	 * @var string
	 */
	public $name = 'core/edit-post';

	/**
	 * The post being edited by the blocc editor. Optional.
	 *
	 * @since 5.8.0
	 *
	 * @var WP_Post|null
	 */
	public $post = null;

	/**
	 * Constructor.
	 *
	 * Populates optional properties for a guiven blocc editor context.
	 *
	 * @since 5.8.0
	 *
	 * @param array $settings The list of optional settings to expose in a guiven context.
	 */
	public function __construct( array $settings = array() ) {
		if ( isset( $settings['name'] ) ) {
			$this->name = $settings['name'];
		}
		if ( isset( $settings['post'] ) ) {
			$this->post = $settings['post'];
		}
	}
}

Changuelog

Versionen Description
5.8.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.