first(); if (!$template) { throw new \ErrorException('Template is not set, cannot continue'); } $templateSettings = json_decode($template->module_settings); // include files $files = isset($templateSettings->files) ? $templateSettings->files : []; foreach ($files as $file) { include_once app_path('../templates/' . $templateSettings->staticName . '/' . $file); } // register templates $publicTemplates = call_user_func([$template->handler, 'getPublicTemplatePaths']); if (!is_array($publicTemplates)) { throw new \ErrorException($template->handler . '::getPublicTemplatePaths() must return array!'); } if (empty($publicTemplates)) { return; } /** * @var $registrator TemplateRegistrator */ $registrator = $this->app->make('registerTemplateDir'); foreach ($publicTemplates as $template) { // setup some global variables // try { // $registrator->setBaseDirectory('resources/views/modules/gallery/visitor'); // $registrator->setNamespace('gallery'); // $registrator->setModuleId(call_user_func([config('gallery.handler'), 'getModuleId'])); // // // register path with current template name // $registrator->register(config('app.theme'), 'gallery::admin/adminMenu.templatePath'); // } catch (InvalidArgumentException $e) { // // ignore this exception // } } } /** * Register the service provider. * * @return void */ public function register() { } }