Automattic\WooCommerce\Blocks
AssetsController::set_block_asset_resource_hints_cache
Set the block asset resource hints in the cache.
Method of the class: AssetsController{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->set_block_asset_resource_hints_cache( $filename, $data );
- $filename(string) (required)
- File name.
- $data(array) (required)
- Array of resource hints.
AssetsController::set_block_asset_resource_hints_cache() AssetsController::set block asset resource hints cache code WC 10.9.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' => Constants::get_constant( 'WC_VERSION' ),
'wordpress' => get_bloginfo( 'version' ),
'site_url' => site_url(),
),
);
$updated['files'][ $filename ] = $data;
set_transient( 'woocommerce_block_asset_resource_hints', $updated, WEEK_IN_SECONDS );
}