Skip to content

Commit

Permalink
Merge pull request #11 from thedevdojo/updatingThemes
Browse files Browse the repository at this point in the history
Updating themes
  • Loading branch information
tnylea authored Apr 10, 2024
2 parents ec5ad84 + 7fdb0a5 commit 4840cc0
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/ThemesServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Blade;
use Laravel\Folio\Folio;
use Illuminate\Support\Facades\File;

class ThemesServiceProvider extends ServiceProvider
{
Expand Down Expand Up @@ -84,6 +87,8 @@ public function boot()
$this->themes_folder = config('themes.themes_folder', resource_path('views/themes'));

$this->loadDynamicMiddleware($this->themes_folder, $theme);
$this->registerThemeComponents($theme);
$this->registerThemeFolioDirectory($theme);

// Make sure we have an active theme
if (isset($theme)) {
Expand Down Expand Up @@ -114,6 +119,21 @@ public function addThemeRoutes($router)
$router->delete('themes/delete', ['uses' => $namespacePrefix.'ThemesController@delete', 'as' => 'theme.delete']);
}

private function registerThemeComponents($theme){
Blade::anonymousComponentPath(resource_path('views/themes/' . $theme->folder . '/components/elements'));
Blade::anonymousComponentPath(resource_path('views/themes/' . $theme->folder . '/components'));
}

private function registerThemeFolioDirectory($theme){
if (File::exists(resource_path('views/themes/' . $theme->folder . '/pages'))) {
Folio::path(resource_path('views/themes/' . $theme->folder . '/pages'))->middleware([
'*' => [
//
],
]);
}
}

/**
* Adds the Theme icon to the admin menu.
*
Expand Down

0 comments on commit 4840cc0

Please sign in to comment.