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 9.9.4
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 ); }