Automattic\WooCommerce\Internal\EmailEditor

PageRenderer::render()publicWC 1.0

Render the email editor page.

Method of the class: PageRenderer{}

No Hooks.

Return

null. Nothing (null).

Usage

$PageRenderer = new PageRenderer();
$PageRenderer->render();

PageRenderer::render() code WC 9.8.2

public function render() {
	$post_id = isset( $_GET['post'] ) ? intval( $_GET['post'] ) : 0;  // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- We are not verifying the nonce here because we are not using the nonce in the function and the data is okay in this context (WP-admin errors out gracefully).
	$post    = get_post( $post_id );

	if ( ! $post instanceof \WP_Post || Integration::EMAIL_POST_TYPE !== $post->post_type ) {
		return;
	}

	// Load the email editor assets.
	$this->load_editor_assets( $post );

	// Load CSS from Post Editor.
	wp_enqueue_style( 'wp-edit-post' );
	// Load CSS for the format library - used for example in popover.
	wp_enqueue_style( 'wp-format-library' );

	// Enqueue media library scripts.
	wp_enqueue_media();

	$this->preload_rest_api_data( $post );

	require_once ABSPATH . 'wp-admin/admin-header.php';
	echo '<div id="mailpoet-email-editor" class="block-editor block-editor__container hide-if-no-js"></div>';
}