WC_REST_Products_Catalog_Controller::catalog_generation_response
Generate catalog and return REST response.
This function orchestrates catalog generation and returns the appropriate response. In the future, it will check if a generation based on the file_info is in progress.
Метод класса: WC_REST_Products_Catalog_Controller{}
Хуков нет.
Возвращает
WP_Error|WP_REST_Response. Response object on success, or WP_Error on failure.
Использование
// private - только в коде основоного (родительского) класса $result = $this->catalog_generation_response( $file_info );
- $file_info(массив) (обязательный)
- File information with
'filepath','url', and'directory'keys.
Код WC_REST_Products_Catalog_Controller::catalog_generation_response() WC REST Products Catalog Controller::catalog generation response WC 10.5.2
private function catalog_generation_response( $file_info ) {
// In the future, check if generation is in progress and return appropriate status.
// For now, generate synchronously.
$result = $this->generate_catalog_file( $file_info );
if ( is_wp_error( $result ) ) {
return $result;
}
return rest_ensure_response(
array(
'status' => 'complete',
'download_url' => $file_info['url'],
)
);
}