Skip to content

Commit

Permalink
save variables again before updateThemeFile
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhahnweilheim committed Nov 1, 2023
1 parent 2e1d0e0 commit 2ef32c5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 7 additions & 3 deletions helpers/FileHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,21 @@ private static function getThemeBaseFile()

public static function updateThemeFile()
{
// Base Theme
$theme_base = file_get_contents(self::getThemeBaseFile());

// CSS Variables
$vars = file_get_contents(self::getVarsFile());
$options = '';

// Get optional CSS
$options = '';
$config = new Config();
if ($config->showUploadAsButtons) {
$options = file_get_contents(self::getOptionsPath() . '/showUploadAsButtons.css');
$options .= file_get_contents(self::getOptionsPath() . '/showUploadAsButtons.css');
}

// Create/Update theme.css
$content = $theme_base . $options . $vars;

file_put_contents(self::getThemeFile(), $content);

// Clear Asset Manager to reload theme.css
Expand Down
3 changes: 3 additions & 0 deletions models/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ public function save() {
$module->settings->set('showTopicMenu', $this->showTopicMenu);
$module->settings->set('showUploadAsButtons', $this->showUploadAsButtons);

// Make sure variables.css has the current colors
(new colorSettings())->saveVarsToFile();

// Update theme.css (apply showUploadAsButtons)
FileHelper::updateThemeFile();

Expand Down

0 comments on commit 2ef32c5

Please sign in to comment.