From 1a2d58f51d55267f920fa5dc0a8eae8d290eb54b Mon Sep 17 00:00:00 2001 From: Mathias Arzberger Date: Wed, 9 Mar 2022 07:37:21 +0100 Subject: [PATCH 1/4] fix Symfony 5 public entry point --- CHANGELOG.md | 1 + src/Module/NatureThemeSetup.php | 12 ++++--- .../templates/frontend/fe_page_nature.html5 | 13 +------ src/ThemeUtils.php | 34 +++++++++++++++++++ 4 files changed, 44 insertions(+), 16 deletions(-) create mode 100644 src/ThemeUtils.php diff --git a/CHANGELOG.md b/CHANGELOG.md index f34ae8e..9cfb6a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [1.8.1](https://github.com/contao-themes-net/nature-theme-bundle/tree/1.8.1) – 2022-02-18 +- [fix] add support for Symfony 5 public entry point - [fix] update fe_page template ## [1.8.0](https://github.com/contao-themes-net/nature-theme-bundle/tree/1.8.0) – 2022-02-15 diff --git a/src/Module/NatureThemeSetup.php b/src/Module/NatureThemeSetup.php index 9d9a526..5fb6927 100644 --- a/src/Module/NatureThemeSetup.php +++ b/src/Module/NatureThemeSetup.php @@ -15,12 +15,16 @@ protected function compile() { switch (\Input::get('act')) { case 'syncFolder': - $path = TL_ROOT . '/web/bundles/contaothemesnetnaturetheme'; + $path = sprintf('%s/%s/bundles/contaothemesnetnaturetheme', + ThemeUtils::getRootDir(), + ThemeUtils::getWebDir() + ); + if(!file_exists("files/naturetheme")) { new \Folder("files/naturetheme"); } $this->getFiles($path); - $this->getSqlFiles($path = TL_ROOT . "/vendor/contao-themes-net/nature-theme-bundle/src/templates"); + $this->getSqlFiles(ThemeUtils::getRootDir() . "/vendor/contao-themes-net/nature-theme-bundle/src/templates"); $this->Template->message = true; $this->Template->version = NatureThemeSetup::VERSION; break; @@ -42,8 +46,8 @@ protected function getFiles($path) { $filesFolder = "files/naturetheme".str_replace("contaothemesnetnaturetheme","",substr($path,$pos))."/".$dir; if($dir != "_nature_variables.scss" && $dir != "_nature_colors.scss" && $dir != "backend.css" && $dir != "nature.scss" && $dir != "nature_win.scss" && $dir != "nature_style.scss" && $dir != "maklermodul.scss" && $dir != "fonts.scss") { - if(!file_exists(TL_ROOT."/".$filesFolder)) { - $objFile = new \File("web/bundles/".substr($path,$pos)."/".$dir, true); + if(!file_exists(ThemeUtils::getRootDir()."/".$filesFolder)) { + $objFile = new \File(ThemeUtils::getWebDir()."/bundles/".substr($path,$pos)."/".$dir, true); $objFile->copyTo($filesFolder); } } diff --git a/src/Resources/contao/templates/frontend/fe_page_nature.html5 b/src/Resources/contao/templates/frontend/fe_page_nature.html5 index 15076de..cc22e49 100644 --- a/src/Resources/contao/templates/frontend/fe_page_nature.html5 +++ b/src/Resources/contao/templates/frontend/fe_page_nature.html5 @@ -24,18 +24,7 @@ stylesheets ?> - + head ?> diff --git a/src/ThemeUtils.php b/src/ThemeUtils.php new file mode 100644 index 0000000..4955a00 --- /dev/null +++ b/src/ThemeUtils.php @@ -0,0 +1,34 @@ +getParameter('kernel.project_dir'); + } + + public static function getWebDir() { + return StringUtil::stripRootDir(System::getContainer()->getParameter('contao.web_dir')); + } + + public static function getCombinedStylesheet() { + + // add stylesheets + $combiner = new Combiner(); + $combiner->add('bundles/contaothemesnetnaturetheme/fonts/fontawesome/css/all.min.css'); + + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { + $combiner->add('bundles/contaothemesnetnaturetheme/scss/nature_win.scss'); + } else { + $combiner->add('bundles/contaothemesnetnaturetheme/scss/nature.scss'); + } + + return $combiner->getCombinedFile(); + } +} From be989c4f4b1b8e463f5b40bf3caf122c89e4dba0 Mon Sep 17 00:00:00 2001 From: Mathias Arzberger Date: Wed, 9 Mar 2022 07:55:33 +0100 Subject: [PATCH 2/4] fix setup --- src/Module/NatureThemeSetup.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Module/NatureThemeSetup.php b/src/Module/NatureThemeSetup.php index 5fb6927..a337c61 100644 --- a/src/Module/NatureThemeSetup.php +++ b/src/Module/NatureThemeSetup.php @@ -2,6 +2,8 @@ namespace ContaoThemesNet\NatureThemeBundle\Module; +use ContaoThemesNet\NatureThemeBundle\ThemeUtils; + class NatureThemeSetup extends \BackendModule { const VERSION = '1.8.1'; From 6a7e94846b2d91443b7888177a4b1e40d591b646 Mon Sep 17 00:00:00 2001 From: Mathias Arzberger Date: Wed, 9 Mar 2022 07:59:52 +0100 Subject: [PATCH 3/4] fix setup --- src/Module/NatureThemeSetup.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Module/NatureThemeSetup.php b/src/Module/NatureThemeSetup.php index a337c61..b63d1a7 100644 --- a/src/Module/NatureThemeSetup.php +++ b/src/Module/NatureThemeSetup.php @@ -26,7 +26,7 @@ protected function compile() new \Folder("files/naturetheme"); } $this->getFiles($path); - $this->getSqlFiles(ThemeUtils::getRootDir() . "/vendor/contao-themes-net/nature-theme-bundle/src/templates"); + $this->getSqlFiles(ThemeUtils::getRootDir()."/vendor/contao-themes-net/nature-theme-bundle/src/templates"); $this->Template->message = true; $this->Template->version = NatureThemeSetup::VERSION; break; From 45f22463d0283e111e456be4d534136e751a1208 Mon Sep 17 00:00:00 2001 From: Philipp Seibt Date: Wed, 9 Mar 2022 13:44:36 +0100 Subject: [PATCH 4/4] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cfb6a2..19044ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## [1.8.1](https://github.com/contao-themes-net/nature-theme-bundle/tree/1.8.1) – 2022-02-18 +## [1.8.1](https://github.com/contao-themes-net/nature-theme-bundle/tree/1.8.1) – 2022-03-09 - [fix] add support for Symfony 5 public entry point - [fix] update fe_page template