Automattic\WooCommerce\Blocks\Assets
Api::get_cached_script_data()
Initialize and load cached script data from the transient cache.
Метод класса: Api{}
Хуков нет.
Возвращает
Массив
.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_cached_script_data();
Код Api::get_cached_script_data() Api::get cached script data WC 9.6.0
private function get_cached_script_data() { if ( $this->disable_cache ) { return []; } $transient_value = json_decode( (string) get_transient( $this->script_data_transient_key ), true ); if ( json_last_error() !== JSON_ERROR_NONE || empty( $transient_value ) || empty( $transient_value['script_data'] ) || empty( $transient_value['version'] ) || $transient_value['version'] !== $this->wc_version || empty( $transient_value['hash'] ) || $transient_value['hash'] !== $this->script_data_hash ) { return []; } return (array) ( $transient_value['script_data'] ?? [] ); }