Automattic\WooCommerce\Admin\Features
Features::maybe_load_beta_features_modal()
Conditionally loads the beta features tracking modal.
Method of the class: Features{}
No Hooks.
Return
null
. Nothing (null).
Usage
$result = Features::maybe_load_beta_features_modal( $hook );
- $hook(string) (required)
- Page hook.
Features::maybe_load_beta_features_modal() Features::maybe load beta features modal code WC 9.7.1
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 ) ); }