Automattic\WooCommerce\Blocks

AssetsController::update_block_style_dependencies()publicWC 1.0

Update block style dependencies after they have been registered.

Method of the class: AssetsController{}

No Hooks.

Return

null. Nothing (null).

Usage

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

AssetsController::update_block_style_dependencies() code WC 8.7.0

public function update_block_style_dependencies() {
	$wp_styles = wp_styles();
	$style     = $wp_styles->query( 'wc-blocks-style', 'registered' );

	if ( ! $style ) {
		return;
	}

	// In WC < 5.5, `woocommerce-general` is not registered in block editor
	// screens, so we don't add it as a dependency if it's not registered.
	// In WC >= 5.5, `woocommerce-general` is registered on `admin_enqueue_scripts`,
	// so we need to check if it's registered here instead of on `init`.
	if (
		wp_style_is( 'woocommerce-general', 'registered' ) &&
		! in_array( 'woocommerce-general', $style->deps, true )
	) {
		$style->deps[] = 'woocommerce-general';
	}
}