Skip to content

Commit

Permalink
Register theme views
Browse files Browse the repository at this point in the history
  • Loading branch information
Timot Tarjani committed Feb 19, 2024
1 parent b586884 commit 29e86d9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
7 changes: 0 additions & 7 deletions app/Http/Middleware/WebsiteMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ class WebsiteMiddleware
*/
public function handle($request, Closure $next)
{


\View::addNamespace('theme', [
"themes/".$request->settings['theme']."/app".DIRECTORY_SEPARATOR."View",
"themes/".$request->settings['theme']."/resources".DIRECTORY_SEPARATOR."views",
]);

$response = $next($request);

$widgets = new \App\Libs\ShortCode();
Expand Down
11 changes: 10 additions & 1 deletion app/Providers/ThemeServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,21 @@ class ThemeServiceProvider extends ServiceProvider
*/
public function boot()
{

// For website
if (!app()->runningInConsole() && !\Request::is(\Config::get('horizontcms.backend_prefix') . "/*")) {
$theme = \App\Model\Settings::get('theme');
$this->loadJsonTranslationsFrom(base_path("themes/" . $theme . "/resources/lang"));
}

// For everything
if(!app()->runningInConsole()){
$theme = \App\Model\Settings::get('theme');
\View::addNamespace('theme', [
"themes/".$theme."/app".DIRECTORY_SEPARATOR."View",
"themes/".$theme."/resources".DIRECTORY_SEPARATOR."views",
]);
}

}

/**
Expand Down

0 comments on commit 29e86d9

Please sign in to comment.