Automattic\WooCommerce\Admin\Features\Navigation

Init::maybe_enqueue_opt_out_scripts()publicWC 1.0

Enqueue the opt out scripts.

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

No Hooks.

Return

null. Nothing.

Usage

$Init = new Init();
$Init->maybe_enqueue_opt_out_scripts();

Code of Init::maybe_enqueue_opt_out_scripts() WC 7.1.0

public function maybe_enqueue_opt_out_scripts() {
	if ( get_option( 'woocommerce_navigation_show_opt_out', 'no' ) !== 'yes' ) {
		return;
	}

	$rtl = is_rtl() ? '.rtl' : '';
	wp_enqueue_style(
		'wc-admin-navigation-opt-out',
		WCAdminAssets::get_url( "navigation-opt-out/style{$rtl}", 'css' ),
		array( 'wp-components' ),
		WCAdminAssets::get_file_version( 'css' )
	);

	WCAdminAssets::register_script( 'wp-admin-scripts', 'navigation-opt-out', true );
	wp_localize_script(
		'wc-admin-navigation-opt-out',
		'surveyData',
		array(
			'url' => Survey::get_url( '/new-navigation-opt-out' ),
		)
	);
	delete_option( 'woocommerce_navigation_show_opt_out' );
}