Skip to content

Commit

Permalink
Add multi domain support
Browse files Browse the repository at this point in the history
  • Loading branch information
seibtph committed Nov 30, 2022
1 parent 45b5470 commit 796ed79
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ Types of changes
Security in case of vulnerabilities.
)

## [1.10.1](https://github.com/contao-themes-net/nature-theme-bundle/tree/1.10.1) – 2022-11-30

- [Added] Add multi domain support

## [1.10.0](https://github.com/contao-themes-net/nature-theme-bundle/tree/1.10.0) – 2022-10-25

- [Added] Add more options to style content slider
Expand Down
2 changes: 1 addition & 1 deletion src/Module/NatureThemeSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

class NatureThemeSetup extends BackendModule
{
public const VERSION = '1.10.0';
public const VERSION = '1.10.1';

protected $strTemplate = 'be_naturetheme_setup';

Expand Down
26 changes: 20 additions & 6 deletions src/ThemeUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/*
* nature theme bundle for Contao Open Source CMS
*
* Copyright (C) 2022 pdir / digital agentur <develop@pdir.de>
* Copyright (C) 2022 pdir / digital agentur // pdir GmbH
*
* @package contao-themes-net/nature-theme-bundle
* @link https://github.com/contao-themes-net/nature-theme-bundle
Expand All @@ -19,31 +19,45 @@
namespace ContaoThemesNet\NatureThemeBundle;

use Contao\Combiner;
use Contao\CoreBundle\Exception\InvalidResourceException;
use Contao\StringUtil;
use Contao\System;

class ThemeUtils
{
public static function getRootDir()
public static string $themeFolder = 'bundles/contaothemesnetnaturetheme/';
public static string $scssFolder = 'scss/';

public static function getRootDir(): string
{
return System::getContainer()->getParameter('kernel.project_dir');
}

public static function getWebDir()
public static function getWebDir(): string
{
return StringUtil::stripRootDir(System::getContainer()->getParameter('contao.web_dir'));
}

public static function getCombinedStylesheet()
/**
* @throws InvalidResourceException
*/
public static function getCombinedStylesheet($theme = null): string
{
self::$scssFolder = self::$themeFolder.self::$scssFolder;

// for multi domain setup
if (null !== $theme) {
self::$scssFolder = 'files/naturetheme/scss/'.$theme.'/';
}

// add stylesheets
$combiner = new Combiner();
$combiner->add('bundles/contaothemesnetnaturetheme/fonts/fontawesome/css/all.min.css');

if ('WIN' === strtoupper(substr(PHP_OS, 0, 3))) {
$combiner->add('bundles/contaothemesnetnaturetheme/scss/nature_win.scss');
$combiner->add(self::$scssFolder.'nature_win.scss');
} else {
$combiner->add('bundles/contaothemesnetnaturetheme/scss/nature.scss');
$combiner->add(self::$scssFolder.'nature.scss');
}

return $combiner->getCombinedFile();
Expand Down

0 comments on commit 796ed79

Please sign in to comment.