Commit d95b4afd authored by Nicolas Widart's avatar Nicolas Widart

Squashed 'Modules/Setting/' changes from e875263..d8d036c

d8d036c Caching more of the setting
5872ba6 Return empty string if no setting available
c72c496 Change method signature
3b56c27 Add a composer file

git-subtree-dir: Modules/Setting
git-subtree-split: d8d036ce49e041183d7ccc5d91703fe06a7b9cbe
parent af819cc4
......@@ -34,7 +34,7 @@ class SettingServiceProvider extends ServiceProvider {
$this->app->booting(function()
{
$loader = AliasLoader::getInstance();
$loader->alias('Modules\Setting\Facades\Settings', 'Settings');
$loader->alias('Settings', 'Modules\Setting\Facades\Settings');
});
}
......
......@@ -36,19 +36,19 @@ class Settings implements Setting
{
if (!$this->cache->has("setting.$name")) {
$setting = $this->setting->get($name);
$this->cache->put("setting.$name", $setting, '3600');
}
$setting = $this->cache->get("setting.$name");
if ($setting) {
if ($setting->isTranslatable) {
return $setting->translate($locale)->value;
if ($setting) {
if ($setting->isTranslatable) {
$this->cache->put("setting.$name", $setting->translate($locale)->value, '3600');
} else {
$this->cache->put("setting.$name", $setting->plainValue, '3600');
}
} else {
$default = is_null($default) ? '' : $default;
$this->cache->put("setting.$name", $default, '3600');
}
return $setting->plainValue;
}
return $default;
return $this->cache->get("setting.$name");
}
/**
......
{
"name": "asgardcms/setting-module",
"type": "asgard-module",
"description": "Setting module for AsgardCMS. Handles all the site settings.",
"keywords": [
"asgardcms",
"settings"
],
"license": "MIT",
"authors": [
{
"name": "Nicolas Widart",
"email": "info@asgardcms.com",
"role": "Developer"
}
],
"support": {
"email": "support@asgardcms.com",
"issues": "https://github.com/AsgardCms/Setting/issues",
"source": "https://github.com/AsgardCms/Setting"
},
"require": {
"php": ">=5.4",
"composer/installers": "~1.0"
},
"minimum-stability": "dev"
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment