From 69c21961a76a04338486e19c3a2c7aafe0f88650 Mon Sep 17 00:00:00 2001 From: Awilum Date: Fri, 29 Jun 2018 16:38:50 +0300 Subject: [PATCH] Plugins: - from now no need to add plugin names manually to the site.yaml - added ability to load plugins blueprints.yaml file - from now plugins configurations stored in the plugin-name.yaml file --- flextype/Plugins.php | 13 +++++++++---- site/config/site.yaml | 4 +--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/flextype/Plugins.php b/flextype/Plugins.php index 41b1a4a4..f38c4464 100755 --- a/flextype/Plugins.php +++ b/flextype/Plugins.php @@ -110,13 +110,14 @@ class Plugins // Set empty plugins item Registry::set('plugins', []); + $plugins_list = Filesystem::getDirList(PATH['plugins']); // If Plugins List isnt empty then create plugin cache ID if (is_array($plugins_list) && count($plugins_list) > 0) { // Go through... foreach ($plugins_list as $plugin) { - if (Filesystem::fileExists($_plugin = PATH['plugins'] . '/' . $plugin . '/' . $plugin . '.yaml')) { + if (Filesystem::fileExists($_plugin = PATH['plugins'] . '/' . $plugin . '/blueprints.yaml')) { $_plugins_cache_id .= filemtime($_plugin); } } @@ -135,11 +136,15 @@ class Plugins // Go through... foreach ($plugins_list as $plugin) { - if (Filesystem::fileExists($_plugin_manifest = PATH['plugins'] . '/' . $plugin . '/' . $plugin . '.yaml')) { - $plugin_manifest = Yaml::parseFile($_plugin_manifest); + if (Filesystem::fileExists($_plugin_blueprints = PATH['plugins'] . '/' . $plugin . '/blueprints.yaml')) { + $plugin_blueprints = Yaml::parseFile($_plugin_blueprints); } - $_plugins_config[basename($_plugin_manifest, '.yaml')] = $plugin_manifest; + if (Filesystem::fileExists($_plugin_config = PATH['plugins'] . '/' . $plugin . '/'. $plugin. '.yaml')) { + $plugin_config = Yaml::parseFile($_plugin_config); + } + + $_plugins_config[basename($_plugin_config, '.yaml')] = array_merge($plugin_blueprints, $plugin_config); } Registry::set('plugins', $_plugins_config); diff --git a/site/config/site.yaml b/site/config/site.yaml index fde606dd..8951af89 100755 --- a/site/config/site.yaml +++ b/site/config/site.yaml @@ -15,8 +15,6 @@ charset: UTF-8 theme: simple -plugins: - locale: "en" pages: @@ -26,7 +24,7 @@ errors: display: true cache: - enabled: true + enabled: false prefix: flextype driver: auto lifetime: 604800