1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-18 02:41:27 +02:00

feat(core): copy themes settings and manifest files content from default to custom folder on themes init.

This commit is contained in:
Awilum
2020-02-19 22:36:39 +03:00
parent 27be38bac0
commit ac81c87bf4

View File

@@ -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) === '') {