Automattic\WooCommerce\Blocks\BlockTypes

ClassicTemplate::enqueue_legacy_assetspublicWC 1.0

Enqueue legacy assets when this block is used as we don't enqueue them for block themes anymore.

Note: This enqueue logic is intentionally duplicated in ProductImageGallery.php to keep legacy blocks independent and allow for separate deprecation paths.

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

Хуков нет.

Возвращает

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

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

$ClassicTemplate = new ClassicTemplate();
$ClassicTemplate->enqueue_legacy_assets();

Заметки

Код ClassicTemplate::enqueue_legacy_assets() WC 10.8.1

public function enqueue_legacy_assets() {
	// Legacy script dependencies for backward compatibility.
	if ( current_theme_supports( 'wc-product-gallery-zoom' ) ) {
		wp_enqueue_script( 'wc-zoom' );
	}

	if ( current_theme_supports( 'wc-product-gallery-slider' ) ) {
		wp_enqueue_script( 'wc-flexslider' );
	}

	if ( current_theme_supports( 'wc-product-gallery-lightbox' ) ) {
		wp_enqueue_script( 'wc-photoswipe-ui-default' );
		wp_enqueue_style( 'photoswipe-default-skin' );
		add_action(
			'wp_footer',
			function () {
				wc_get_template( 'single-product/photoswipe.php' );
			}
		);
	}

	wp_enqueue_script( 'wc-single-product' );
}