diff --git a/app/Handlers/Contracts/TemplateHandler.php b/app/Handlers/Contracts/TemplateHandler.php index 6864639b..d21fb126 100644 --- a/app/Handlers/Contracts/TemplateHandler.php +++ b/app/Handlers/Contracts/TemplateHandler.php @@ -1,6 +1,7 @@ module_handler; + $template = Module::where('is_template', true)->where('enabled', true)->first(); + + // do something template-specific + $page = call_user_func([$template->handler, 'beforeRender'], $page); + // render page return $handler->render($page, ''); } diff --git a/templates/Base/OnePage/Handlers/OnePage.php b/templates/Base/OnePage/Handlers/OnePage.php index a02e571b..3c401045 100644 --- a/templates/Base/OnePage/Handlers/OnePage.php +++ b/templates/Base/OnePage/Handlers/OnePage.php @@ -2,6 +2,7 @@ namespace Templates\Base\OnePage\Handlers; use App\Handlers\Contracts\TemplateHandler; +use App\Models\Content; use App\Models\Module; use App\Models\User; @@ -31,4 +32,9 @@ abstract class OnePage implements TemplateHandler public static function uninstall(Module $template) { } + + public static function beforeRender(Content $content) + { + return $content; + } } \ No newline at end of file diff --git a/templates/Jednostrankovka/Handler.php b/templates/Jednostrankovka/Handler.php index c4ff73f9..6c4e1d35 100644 --- a/templates/Jednostrankovka/Handler.php +++ b/templates/Jednostrankovka/Handler.php @@ -1,6 +1,7 @@ content = str_replace('a', 'AAAA', $content->content); + + return $content; + } } diff --git a/templates/Jednostrankovka/Resources/views/modules/article/admin/content/novy.blade.php b/templates/Jednostrankovka/Resources/views/modules/staticpages/visitor/test.blade.php similarity index 100% rename from templates/Jednostrankovka/Resources/views/modules/article/admin/content/novy.blade.php rename to templates/Jednostrankovka/Resources/views/modules/staticpages/visitor/test.blade.php