aboutsummaryrefslogtreecommitdiff
path: root/lib/classes/PageLayout.php
diff options
context:
space:
mode:
authorRon Lucke <lucke@elan-ev.de>2025-07-14 09:36:18 +0200
committerRon Lucke <lucke@elan-ev.de>2025-07-14 09:36:18 +0200
commit4355ded9bc56e0b06fbceffe61ddc37061cc3bc7 (patch)
tree348493b6b0fd1286b86f213e5077413b97cf9747 /lib/classes/PageLayout.php
parent1e59dd2dacc51b3313d7780b66d4bf72e0484f86 (diff)
Color-Themes-System, fixes #5361
Closes #5361 Merge request studip/studip!4038
Diffstat (limited to 'lib/classes/PageLayout.php')
-rw-r--r--lib/classes/PageLayout.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/classes/PageLayout.php b/lib/classes/PageLayout.php
index c4d0f6c..94bc133 100644
--- a/lib/classes/PageLayout.php
+++ b/lib/classes/PageLayout.php
@@ -161,6 +161,11 @@ class PageLayout
URLHelper::setBaseURL($old_base);
}
+
+ self::addHeadElement('link', [
+ 'rel' => 'stylesheet',
+ 'href' => Assets::url('stylesheets/theme.php')
+ ]);
}
/**
@@ -271,6 +276,28 @@ class PageLayout
}
/**
+ * Add CSS variables to the :root selector in the HTML HEAD section.
+ *
+ * @param array $variables Associative array of CSS variable names and values.
+ */
+ public static function addRootStyle(array $variables)
+ {
+ if (empty($variables)) {
+ return;
+ }
+
+ $style = ':root {' . PHP_EOL;
+ foreach ($variables as $name => $value) {
+ $style .= " --$name: $value;" . PHP_EOL;
+ }
+ $style .= '}' . PHP_EOL;
+
+ // Add the <style> tag with the generated CSS to the head
+ self::addHeadElement('style', [], $style);
+ }
+
+
+ /**
* Add a STYLE element to the HTML HEAD section.
*
* @param string $content element contents