Automattic\WooCommerce\Internal\EmailEditor

Integration::replace_editor │ public │ WC 1.0

Replace the default editor with our custom email editor.

Метод класса: Integration{}

Хуков нет.

Возвращает

bool. Whether the editor was replaced.

Использование

$Integration = new Integration();
$Integration->replace_editor( $replace, $post );
$replace(true|false) (обязательный)
Whether to replace the editor.
$post(WP_Post) (обязательный)
Post object.

Код Integration::replace_editor() WC 11.3.0

public function replace_editor( $replace, $post ) {
	$current_screen = get_current_screen();
	if ( self::EMAIL_POST_TYPE === $post->post_type && $current_screen ) {
		// This callback re-enters while the editor renders: WP_Screen::get() re-applies
		// the `replace_editor` filter, and plugins call it from admin_enqueue_scripts,
		// which admin-header.php fires mid-render. Rendering again would echo a second
		// editor container inside <head> and break the page.
		if ( $this->editor_rendered ) {
			return true;
		}
		$this->editor_rendered = true;
		$this->maybe_refresh_scratchpad( $post );
		$this->editor_page_renderer->render();
		return true;
	}
	return $replace;
}