Automattic\WooCommerce\Blocks

AssetsController::register_and_enqueue_site_editor_assets()publicWC 1.0

Register and enqueue assets for exclusive usage within the Site Editor.

Method of the class: AssetsController{}

No Hooks.

Return

null. Nothing (null).

Usage

$AssetsController = new AssetsController();
$AssetsController->register_and_enqueue_site_editor_assets();

AssetsController::register_and_enqueue_site_editor_assets() code WC 9.0.1

public function register_and_enqueue_site_editor_assets() {
	$this->api->register_script( 'wc-blocks-classic-template-revert-button', 'assets/client/blocks/wc-blocks-classic-template-revert-button.js' );
	$this->api->register_style( 'wc-blocks-classic-template-revert-button-style', 'assets/client/blocks/wc-blocks-classic-template-revert-button-style.css' );

	$current_screen = get_current_screen();
	if ( $current_screen instanceof \WP_Screen && 'site-editor' === $current_screen->base ) {
		wp_enqueue_script( 'wc-blocks-classic-template-revert-button' );
		wp_enqueue_style( 'wc-blocks-classic-template-revert-button-style' );
	}
}