From 8203c10f37d1fa4ead5ce61554a817e1f8d7b587 Mon Sep 17 00:00:00 2001 From: Yasen Pramatarov Date: Thu, 19 Jun 2025 13:45:14 +0300 Subject: [PATCH] Adds theme data to be passed to the views --- app/pages/theme.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/pages/theme.php b/app/pages/theme.php index 8d245f7..09e09d3 100644 --- a/app/pages/theme.php +++ b/app/pages/theme.php @@ -48,6 +48,19 @@ if (isset($_GET['switch_to'])) { $themes = \App\Helpers\Theme::getAvailableThemes(); $currentTheme = \App\Helpers\Theme::getCurrentThemeName(); +// Prepare theme data with screenshot URLs for the view +$themeData = []; +foreach ($themes as $id => $name) { + $themeData[$id] = [ + 'name' => $name, + 'screenshotUrl' => \App\Helpers\Theme::getScreenshotUrl($id), + 'isActive' => $id === $currentTheme + ]; +} + +// Make theme data available to the view +$themes = $themeData; + // Generate CSRF token for the form $csrf_token = $security->generateCsrfToken();