mirror of
https://github.com/unraid/webgui.git
synced 2026-01-06 01:29:54 -06:00
refactor: centralize stylesheet inclusion logic in DefaultPageLayout.php by creating includePageStylesheets function for improved code reuse and maintainability
This commit is contained in:
@@ -135,18 +135,26 @@ if ($themeHelper->isSidebarTheme()) {
|
||||
<? require_once "$docroot/plugins/dynamix/include/DefaultPageLayout/HeadInlineJS.php"; ?>
|
||||
|
||||
<?
|
||||
foreach ($buttonPages as $button) {
|
||||
annotate($button['file']);
|
||||
// include page specific stylesheets (if existing)
|
||||
$css = "/{$button['root']}/sheets/{$button['name']}";
|
||||
function includePageStylesheets($page) {
|
||||
global $docroot, $theme;
|
||||
$css = "/{$page['root']}/sheets/{$page['name']}";
|
||||
$css_stock = "$css.css";
|
||||
$css_theme = "$css-$theme.css"; // @todo add syslog for deprecation notice
|
||||
if (is_file($docroot.$css_stock)) echo '<link type="text/css" rel="stylesheet" href="',autov($css_stock),'">',"\n";
|
||||
if (is_file($docroot.$css_theme)) echo '<link type="text/css" rel="stylesheet" href="',autov($css_theme),'">',"\n";
|
||||
// create page content
|
||||
}
|
||||
|
||||
foreach ($buttonPages as $button) {
|
||||
annotate($button['file']);
|
||||
includePageStylesheets($button);
|
||||
eval('?>'.parse_text($button['text']));
|
||||
}
|
||||
|
||||
foreach ($pages as $page) {
|
||||
annotate($page['file']);
|
||||
includePageStylesheets($page);
|
||||
}
|
||||
|
||||
// Reload page every X minutes during extended viewing?
|
||||
if (isset($myPage['Load'])) {
|
||||
echo generateReloadScript($myPage['Load']);
|
||||
|
||||
Reference in New Issue
Block a user