From ac81c87bf40ceb4eb9820ef7d1edba063a52169f Mon Sep 17 00:00:00 2001 From: Awilum Date: Wed, 19 Feb 2020 22:36:39 +0300 Subject: [PATCH] feat(core): copy themes `settings` and `manifest` files content from `default` to `custom` folder on themes init. --- flextype/core/Themes.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/flextype/core/Themes.php b/flextype/core/Themes.php index e004566c..c55fe48a 100644 --- a/flextype/core/Themes.php +++ b/flextype/core/Themes.php @@ -83,10 +83,6 @@ class Themes // Create site theme settings directory ! Filesystem::has($site_theme_settings_dir) and Filesystem::createDir($site_theme_settings_dir); - // Create site theme settings and manifest files - ! Filesystem::has($site_theme_settings_file) and Filesystem::write($site_theme_settings_file, ''); - ! Filesystem::has($site_theme_manifest_file) and Filesystem::write($site_theme_manifest_file, ''); - // Check if default theme settings file exists if (! Filesystem::has($default_theme_settings_file)) throw new RuntimeException('Load ' . $theme['dirname'] . ' theme settings - failed!'); @@ -94,6 +90,9 @@ class Themes $default_theme_settings_file_content = Filesystem::read($default_theme_settings_file); $default_theme_settings = $this->flextype['parser']->decode($default_theme_settings_file_content, 'yaml'); + // Create site theme settings file + ! Filesystem::has($site_theme_settings_file) and Filesystem::write($site_theme_settings_file, $default_theme_settings_file_content); + // Get site theme settings content $site_theme_settings_file_content = Filesystem::read($site_theme_settings_file); if (trim($site_theme_settings_file_content) === '') { @@ -109,6 +108,9 @@ class Themes $default_theme_manifest_file_content = Filesystem::read($default_theme_manifest_file); $default_theme_manifest = $this->flextype['parser']->decode($default_theme_manifest_file_content, 'yaml'); + // Create site theme file + ! Filesystem::has($site_theme_manifest_file) and Filesystem::write($site_theme_manifest_file, $default_theme_manifest_file_content); + // Get site theme manifest content $site_theme_manifest_file_content = Filesystem::read($site_theme_manifest_file); if (trim($site_theme_manifest_file_content) === '') {