Automattic\WooCommerce\Internal\Admin

Loader::inject_before_notices()public staticWC 1.0

Runs before admin notices action and hides them.

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

Хуков нет.

Возвращает

null. Ничего.

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

$result = Loader::inject_before_notices();

Код Loader::inject_before_notices() WC 7.3.0

public static function inject_before_notices() {
	if ( ! PageController::is_admin_or_embed_page() ) {
		return;
	}

	// The JITMs won't be shown in the Onboarding Wizard.
	$is_onboarding   = isset( $_GET['path'] ) && '/setup-wizard' === wc_clean( wp_unslash( $_GET['path'] ) ); // phpcs:ignore WordPress.Security.NonceVerification
	$maybe_hide_jitm = $is_onboarding ? '-hide' : '';

	echo '<div class="woocommerce-layout__jitm' . sanitize_html_class( $maybe_hide_jitm ) . '" id="jp-admin-notices"></div>';

	// Wrap the notices in a hidden div to prevent flickering before
	// they are moved elsewhere in the page by WordPress Core.
	echo '<div class="woocommerce-layout__notice-list-hide" id="wp__notice-list">';

	if ( PageController::is_admin_page() ) {
		// Capture all notices and hide them. WordPress Core looks for
		// `.wp-header-end` and appends notices after it if found.
		// https://github.com/WordPress/WordPress/blob/f6a37e7d39e2534d05b9e542045174498edfe536/wp-admin/js/common.js#L737 .
		echo '<div class="wp-header-end" id="woocommerce-layout__notice-catcher"></div>';
	}
}