From 8f19e0ee888a4e6d8a8a3605255e4869424df384 Mon Sep 17 00:00:00 2001 From: Alena Stanul Date: Mon, 6 Feb 2023 06:49:34 +0000 Subject: [PATCH] [#69] Class 'Drupal\bootstrap\Bootstrap' not found error --- 2222.patch | 0 src/Service/SwaggerUiLibraryDiscovery.php | 11 ++++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 2222.patch diff --git a/2222.patch b/2222.patch new file mode 100644 index 00000000..e69de29b diff --git a/src/Service/SwaggerUiLibraryDiscovery.php b/src/Service/SwaggerUiLibraryDiscovery.php index 3dcc30a3..55055ade 100644 --- a/src/Service/SwaggerUiLibraryDiscovery.php +++ b/src/Service/SwaggerUiLibraryDiscovery.php @@ -108,7 +108,16 @@ public function libraryDirectory(): string { $library_dir = 'libraries/swagger-ui'; // Allow the default theme to alter the default library directory. $default_theme = $this->themeInitialization->getActiveThemeByName($this->themeHandler->getDefault()); - $this->themeInitialization->loadActiveTheme($default_theme); + // @todo Remove \Throwable cathing when registration the namespaces + // of installed themes will be implemented. + // https://www.drupal.org/project/drupal/issues/2941757 + try { + $this->themeInitialization->loadActiveTheme($default_theme); + } + catch (\Throwable $error) { + $this->themeHandler->listInfo(); + $this->themeInitialization->loadActiveTheme($default_theme); + } // The hook is only invoked for the default theme (and its base themes). $this->themeManager->alterForTheme($default_theme, 'swagger_ui_library_directory', $library_dir); // Make sure that the directory path is relative (to DRUPAL ROOT).