Hello,
I'm trying to setup a single global layout for a multi-module setup (based on MVC Multi-shared Layouts).
I've defined a services.php bootloader where I configure my view service:
$di['view'] = function() {
$view = new View();
$view->setLayoutsDir(__DIR__ . '/../resources/layouts/');
$view->setTemplateAfter('main');
$view->registerEngines([
".volt" => function ($view, $di) {
$volt = new Volt($view, $di);
$volt->setOptions(array(
'compiledPath' => __DIR__ . "/../storage/cache/volt/",
'compiledSeparator' => '_',
'compileAlways' => true
));
return $volt;
}
]);
return $view;
};
On my Module.php, I've defined my module views directory:
public function registerServices (DiInterface $di) {
$di->get('view')->setViewsDir(__DIR__ . '/views/');
}
My main problem is that the main.volt layout is not loading prior to my module view. I don't get any error, but I can't get my view wrapper inside my main layout. Only the module view is displayed.
Anyone knows a workaround or a better way to achieve this?
Thank you.