FEATURE #1453: add registration of templates

This commit is contained in:
Michal Kváček
2016-02-18 16:28:32 +01:00
parent 214cc9f3f9
commit 66c9d7907a
9 changed files with 457 additions and 1 deletions
+21
View File
@@ -2,6 +2,7 @@
namespace App\Providers;
use App\Handlers\Registrators\TemplateRegistrator;
use App\Handlers\Registrators\WidgetRegistrator;
use App\Widgets\HtmlCode\HtmlCode;
use Illuminate\Support\ServiceProvider;
@@ -16,6 +17,7 @@ class AppServiceProvider extends ServiceProvider
public function boot()
{
$this->registerWidgets();
$this->registerTemplates();
}
/**
@@ -38,6 +40,11 @@ class AppServiceProvider extends ServiceProvider
$this->app->singleton('registerWidget', function ($app) {
return new WidgetRegistrator($app);
});
// create registrator for template directories
$this->app->singleton('registerTemplateDir', function ($app) {
return new TemplateRegistrator($app);
});
}
/**
@@ -53,4 +60,18 @@ class AppServiceProvider extends ServiceProvider
// register all available widgets
$registrator->register(HtmlCode::class);
}
/**
* Register path with editable contents
*/
private function registerTemplates()
{
/**
* @var $registrator TemplateRegistrator
*/
$registrator = $this->app->make('registerTemplateDir');
$registrator->setBaseDirectory('resources/views/visitor');
$registrator->register(config('app.theme'), trans('admin/templates.core'));
}
}