Added a Theme::databaseLayerEnabled method to make checking for the db layer easier
This commit is contained in:
parent
0a8450b21c
commit
7809f9ada5
|
|
@ -505,6 +505,21 @@ class Theme
|
|||
return ThemeData::forTheme($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if the database layer has been enabled
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function databaseLayerEnabled()
|
||||
{
|
||||
$enableDbLayer = Config::get('cms.enableDatabaseLayer', false);
|
||||
if (is_null($enableDbLayer)) {
|
||||
$enableDbLayer = !Config::get('app.debug');
|
||||
}
|
||||
|
||||
return $enableDbLayer && App::hasDatabase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures this theme is registered as a Halcyon them datasource.
|
||||
* @return void
|
||||
|
|
@ -514,12 +529,7 @@ class Theme
|
|||
$resolver = App::make('halcyon');
|
||||
|
||||
if (!$resolver->hasDatasource($this->dirName)) {
|
||||
$enableDbLayer = Config::get('cms.enableDatabaseLayer', false);
|
||||
if (is_null($enableDbLayer)) {
|
||||
$enableDbLayer = !Config::get('app.debug');
|
||||
}
|
||||
|
||||
if ($enableDbLayer && App::hasDatabase()) {
|
||||
if (static::databaseLayerEnabled()) {
|
||||
$datasource = new AutoDatasource([
|
||||
new DbDatasource($this->dirName, 'cms_theme_contents'),
|
||||
new FileDatasource($this->getPath(), App::make('files')),
|
||||
|
|
|
|||
|
|
@ -464,7 +464,11 @@ class Index extends Controller
|
|||
*/
|
||||
protected function canCommitTemplate($template)
|
||||
{
|
||||
$result = true;
|
||||
$result = true; // will set to false by default
|
||||
|
||||
if (Theme::databaseLayerEnabled()) {
|
||||
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
|
@ -477,7 +481,11 @@ class Index extends Controller
|
|||
*/
|
||||
protected function canResetTemplate($template)
|
||||
{
|
||||
$result = true;
|
||||
$result = true; // will set to false by default
|
||||
|
||||
if (Theme::databaseLayerEnabled()) {
|
||||
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue