WC_Admin_Assets::should_show_lost_connection_noticeprivateWC 1.0

Whether the current screen should get the #wc-lost-connection-notice markup and toggle handler. Limited to Woo admin screens, minus wc-admin React pages and classic post edit screens, which get WP core's own notice. Classic order edit is the exception: core's notice there wrongly claims local autosave backups are running, which disable_autosave() has turned off.

Method of the class: WC_Admin_Assets{}

No Hooks.

Returns

true|false. Whether to render and toggle the notice.

Usage

// private - for code of main (parent) class only
$result = $this->should_show_lost_connection_notice();

WC_Admin_Assets::should_show_lost_connection_notice() code WC 11.0.0

private function should_show_lost_connection_notice() {
	$screen = get_current_screen();

	if ( ! $screen || ! in_array( $screen->id, wc_get_screen_ids(), true ) ) {
		return false;
	}

	$is_wc_admin_page = class_exists( '\Automattic\WooCommerce\Admin\PageController' )
		&& \Automattic\WooCommerce\Admin\PageController::is_admin_page();
	if ( $is_wc_admin_page ) {
		return false;
	}

	$is_classic_order_edit_screen = 'post' === $screen->base
		&& in_array( $screen->post_type, wc_get_order_types( 'order-meta-boxes' ), true );

	return 'post' !== $screen->base || $is_classic_order_edit_screen;
}