Automattic\WooCommerce\Internal\EmailEditor

Integration::is_editor_page()publicWC 1.0

Check if current page is email editor page.

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

Хуков нет.

Возвращает

true|false. Whether current page is email editor page.

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

$Integration = new Integration();
$Integration->is_editor_page( $is_editor_page ): bool;
$is_editor_page(true|false) (обязательный)
Current editor page status.

Код Integration::is_editor_page() WC 9.8.1

public function is_editor_page( bool $is_editor_page ): bool {
	if ( $is_editor_page ) {
		return $is_editor_page;
	}

	// We need to check early if we are on the email editor page. The check runs early so we can't use current_screen() here.
	if ( is_admin() && isset( $_GET['post'] ) && isset( $_GET['action'] ) && 'edit' === $_GET['action'] ) { // 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( (int) $_GET['post'] ); // 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).
		return $post && self::EMAIL_POST_TYPE === $post->post_type;
	}

	return false;
}