Automattic\WooCommerce\Blocks

AssetsController::set_block_asset_resource_hints_cache()privateWC 1.0

Set the block asset resource hints in the cache.

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

Хуков нет.

Возвращает

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

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

// private - только в коде основоного (родительского) класса
$result = $this->set_block_asset_resource_hints_cache( $filename, $data );
$filename(строка) (обязательный)
File name.
$data(массив) (обязательный)
Array of resource hints.

Код AssetsController::set_block_asset_resource_hints_cache() WC 9.7.1

private function set_block_asset_resource_hints_cache( $filename, $data ) {
	$cache   = $this->get_block_asset_resource_hints_cache();
	$updated = array(
		'files'   => $cache ?? array(),
		'version' => array(
			'woocommerce' => WOOCOMMERCE_VERSION,
			'wordpress'   => get_bloginfo( 'version' ),
		),
	);

	$updated['files'][ $filename ] = $data;
	set_site_transient( 'woocommerce_block_asset_resource_hints', $updated, WEEK_IN_SECONDS );
}