Automattic\WooCommerce\Admin\Features

Features::maybe_load_beta_features_modal()public staticWC 1.0

Conditionally loads the beta features tracking modal.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

$result = Features::maybe_load_beta_features_modal( $hook );
$hook(строка) (обязательный)
Page hook.

Код Features::maybe_load_beta_features_modal() WC 8.9.0

public static function maybe_load_beta_features_modal( $hook ) {
	if (
		'woocommerce_page_wc-settings' !== $hook ||
		! isset( $_GET['tab'] ) || 'advanced' !== $_GET['tab'] || // phpcs:ignore CSRF ok.
		! isset( $_GET['section'] ) || 'features' !== $_GET['section'] // phpcs:ignore CSRF ok.
	) {
		return;
	}
	$tracking_enabled = get_option( 'woocommerce_allow_tracking', 'no' );

	if ( empty( self::$beta_features ) ) {
		return;
	}

	if ( 'yes' === $tracking_enabled ) {
		return;
	}

	WCAdminAssets::register_style( 'beta-features-tracking-modal', 'style', array( 'wp-components' ) );
	WCAdminAssets::register_script( 'wp-admin-scripts', 'beta-features-tracking-modal', array( 'wp-i18n', 'wp-element', WC_ADMIN_APP ) );
}