Automattic\WooCommerce\Blocks
AssetsController::set_block_asset_resource_hints_cache
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() AssetsController::set block asset resource hints cache WC 10.5.0
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 );
}