diff --git a/system/config/streams.yaml b/system/config/streams.yaml index 1ea6f2acd..0ab5c3f8b 100644 --- a/system/config/streams.yaml +++ b/system/config/streams.yaml @@ -5,6 +5,11 @@ schemes: - user/plugins - system/plugins + user: + type: ReadOnlyStream + paths: + - user + # asset: # type: ReadOnlyStream # paths: diff --git a/system/src/Grav/Common/Page/Pages.php b/system/src/Grav/Common/Page/Pages.php index 24da249f3..f87bd8aee 100644 --- a/system/src/Grav/Common/Page/Pages.php +++ b/system/src/Grav/Common/Page/Pages.php @@ -257,10 +257,7 @@ class Pages public function blueprints($type) { if (!isset($this->blueprints)) { - /** @var Config $config */ - $config = $this->grav['config']; - - $this->blueprints = new Data\Blueprints(THEMES_DIR . $config->get('system.pages.theme') . '/blueprints/'); + $this->blueprints = new Data\Blueprints('theme://blueprints/'); } try { @@ -314,12 +311,7 @@ class Pages */ static public function types() { - $grav = Grav::instance(); - - /** @var Config $config */ - $config = $grav['config']; - - $blueprints = new Data\Blueprints(THEMES_DIR . $config->get('system.pages.theme') . '/blueprints/'); + $blueprints = new Data\Blueprints('theme://blueprints/'); return $blueprints->types(); } diff --git a/system/src/Grav/Common/Plugins.php b/system/src/Grav/Common/Plugins.php index 5990ca0c4..1d0e8d26e 100644 --- a/system/src/Grav/Common/Plugins.php +++ b/system/src/Grav/Common/Plugins.php @@ -101,18 +101,18 @@ class Plugins extends Iterator return $list; } - static public function get($type) + static public function get($name) { - $blueprints = new Data\Blueprints('plugin://' . $type); + $blueprints = new Data\Blueprints("plugin://{$name}"); $blueprint = $blueprints->get('blueprints'); - $blueprint->name = $type; + $blueprint->name = $name; // Load default configuration. - $file = File\Yaml::instance('plugin://' . "{$type}/{$type}" . YAML_EXT); + $file = File\Yaml::instance("plugin://{$name}/{$name}.yaml"); $obj = new Data\Data($file->content(), $blueprint); // Override with user configuration. - $file = File\Yaml::instance('plugin://' . "config/plugins/{$type}" . YAML_EXT); + $file = File\Yaml::instance("user://config/plugins/{$name}.yaml"); $obj->merge($file->content()); // Save configuration always to user/config. diff --git a/system/src/Grav/Common/Themes.php b/system/src/Grav/Common/Themes.php index 852a34df7..7827afbda 100644 --- a/system/src/Grav/Common/Themes.php +++ b/system/src/Grav/Common/Themes.php @@ -49,33 +49,33 @@ class Themes /** * Get theme or throw exception if it cannot be found. * - * @param string $type + * @param string $name * @return Data\Data * @throws \RuntimeException */ - public function get($type) + public function get($name) { - if (!$type) { + if (!$name) { throw new \RuntimeException('Theme name not provided.'); } - $blueprints = new Data\Blueprints(THEMES_DIR . $type); + $blueprints = new Data\Blueprints("theme://{$name}"); $blueprint = $blueprints->get('blueprints'); - $blueprint->name = $type; + $blueprint->name = $name; // Find thumbnail. - $thumb = THEMES_DIR . "{$type}/thumbnail.jpg"; + $thumb = THEMES_DIR . "{$name}/thumbnail.jpg"; if (file_exists($thumb)) { // TODO: use real URL with base path. - $blueprint->set('thumbnail', "/user/themes/{$type}/thumbnail.jpg"); + $blueprint->set('thumbnail', "/user/themes/{$name}/thumbnail.jpg"); } // Load default configuration. - $file = File\Yaml::instance(THEMES_DIR . "{$type}/{$type}" . YAML_EXT); + $file = File\Yaml::instance("theme://{$name}.yaml"); $obj = new Data\Data($file->content(), $blueprint); // Override with user configuration. - $file = File\Yaml::instance(USER_DIR . "config/themes/{$type}" . YAML_EXT); + $file = File\Yaml::instance("user://config/themes/{$name}.yaml"); $obj->merge($file->content()); // Save configuration always to user/config.