Hello Partypeople,
I have a Multiple-Shared-Views MVC structured Phalcon Project. Everything is in a nice module and have a order.
But! My view filters and functions for the whole project are registered in the common module (my base module), lets call it viewService. I would like to register just the important things of viewService in my common module, like a filter for dates (used in almost every module). After that I want to register the module specific filter & functions (like currency translation) within my already registered viewService in the affected module.
So I imagend somthing like:
CommonModule:
$di->setShared('view', function () use ($di) {
$config = $di->get('config');
$view = new View();
$view->registerEngines([
'.volt' => function ($view, $di) use ($config) {
.
.
$compiler->addFilter('date', 'Format::date');
.
.
}
}
AffectedModule:
$di->getShared('view', function () use ($di) {
$registeredView = getRegisteredView();
$registeredView->addEngines([
'.volt' => function ($view, $di) use ($config) {
$compiler->addFilter('price', function ($price) { return "Format::price($price, ',', '.')"; });
.
.
.
}
}
Unfortunately I didn't find any solution for my problem. If I try to get the .volt
array from $di->getShared("view")->getRegisteredEngines()
, I get only an empty array.
I hope someone can help me out.