function swagger_ui_formatter_cache_flush in Swagger UI Field Formatter 8.3
Same name and namespace in other branches
- 8.2 swagger_ui_formatter.module \swagger_ui_formatter_cache_flush()
Implements hook_cache_flush().
File
- ./
swagger_ui_formatter.module, line 110
Code
function swagger_ui_formatter_cache_flush() : void {
// The library discovery service might not exist in certain situations (like
// when someone upgrades the module from 8.x-2.x) so we check its existence.
// @todo The condition can be removed in 4.x.
$service_name = 'swagger_ui_formatter.swagger_ui_library_discovery';
if (\Drupal::hasService($service_name)) {
/** @var \Drupal\swagger_ui_formatter\Service\SwaggerUiLibraryDiscoveryInterface $swagger_ui_library_discovery */
$swagger_ui_library_discovery = \Drupal::service($service_name);
if (method_exists($swagger_ui_library_discovery, 'reset')) {
$swagger_ui_library_discovery
->reset();
}
}
}