mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
Move theme localization to the boot process. (#5349)
It appears that doing this in the "register" process can result, at times, in an exception to be thrown as the connection to the DB is not yet established.
This commit is contained in:
parent
50816a9556
commit
16e0bd4d09
@ -44,7 +44,6 @@ class ServiceProvider extends ModuleServiceProvider
|
||||
$this->registerBackendPermissions();
|
||||
$this->registerBackendWidgets();
|
||||
$this->registerBackendSettings();
|
||||
$this->registerBackendLocalization();
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,6 +58,10 @@ class ServiceProvider extends ModuleServiceProvider
|
||||
|
||||
$this->bootMenuItemEvents();
|
||||
$this->bootRichEditorEvents();
|
||||
|
||||
if (App::runningInBackend()) {
|
||||
$this->bootBackendLocalization();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -303,16 +306,16 @@ class ServiceProvider extends ModuleServiceProvider
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers localization from an active theme for backend items.
|
||||
* Boots localization from an active theme for backend items.
|
||||
*/
|
||||
protected function registerBackendLocalization()
|
||||
protected function bootBackendLocalization()
|
||||
{
|
||||
$theme = CmsTheme::getActiveTheme();
|
||||
|
||||
$langPath = $theme->getPath() . '/lang';
|
||||
|
||||
if (File::isDirectory($langPath)) {
|
||||
Lang::addNamespace("themes.{$theme->getId()}", $langPath);
|
||||
Lang::addNamespace('themes.' . $theme->getId(), $langPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user