app/library/Services.php: update view initialization
This commit is contained in:
parent
abcbf8759e
commit
2dd571cd3d
1 changed files with 13 additions and 12 deletions
|
|
@ -12,6 +12,7 @@ use Phalcon\Di\FactoryDefault as DiDefault,
|
|||
Phalcon\Flash\Direct as FlashDirect,
|
||||
Phalcon\Mvc\Model\Metadata\Memory as MemoryMetaData,
|
||||
Phalcon\Mvc\Model\MetaData\Apc as ApcMetaData,
|
||||
Phalcon\Mvc\ViewBaseInterface,
|
||||
Phalcon\Cache\Frontend\Data as FrontendDataCache,
|
||||
Phalcon\Cache\Backend\Apc as BackendApcCache,
|
||||
Phalcon\Translate\Adapter\NativeArray as TranslateAdapter,
|
||||
|
|
@ -227,23 +228,23 @@ class Services extends DiDefault
|
|||
$view->setPartialsDir('_partials/');
|
||||
|
||||
$view->registerEngines(array(
|
||||
'.volt' => function ($view, $di) use ($config) {
|
||||
'.volt' => function (ViewBaseInterface $view) use ($config) {
|
||||
|
||||
$volt = new VoltEngine($view, $di);
|
||||
$volt = new VoltEngine($view, $this);
|
||||
|
||||
$volt->setOptions(array(
|
||||
'compiledPath' => $config->application->viewCacheDir,
|
||||
'compiledSeparator' => '_',
|
||||
'compileAlways' => true,
|
||||
'path' => $config->application->viewCacheDir,
|
||||
'separator' => '_',
|
||||
'always' => true,
|
||||
));
|
||||
|
||||
// Register view helpers
|
||||
$compiler = $volt->getCompiler();
|
||||
$compiler->addExtension(new ViewHelperVoltExtension($di));
|
||||
$compiler->addExtension(new ViewHelperVoltExtension($this));
|
||||
|
||||
return $volt;
|
||||
},
|
||||
'.phtml' => 'Phalcon\Mvc\View\Engine\Php'
|
||||
'.phtml' => \Phalcon\Mvc\View\Engine\Php::class
|
||||
));
|
||||
|
||||
// Set default main layout.
|
||||
|
|
@ -367,17 +368,17 @@ class Services extends DiDefault
|
|||
$view = new SimpleView();
|
||||
$view->setViewsDir($config->application->templateDir);
|
||||
$view->registerEngines([
|
||||
'.volt' => function ($view, $di) use ($config) {
|
||||
$volt = new VoltEngine($view, $di);
|
||||
'.volt' => function (ViewBaseInterface $view) use ($config) {
|
||||
$volt = new VoltEngine($view, $this);
|
||||
|
||||
$volt->setOptions(array(
|
||||
'compiledPath' => $config->application->viewCacheDir,
|
||||
'compiledSeparator' => '_',
|
||||
'path' => $config->application->viewCacheDir,
|
||||
'separator' => '_',
|
||||
));
|
||||
|
||||
return $volt;
|
||||
},
|
||||
'.phtml' => 'Phalcon\Mvc\View\Engine\Php'
|
||||
'.phtml' => \Phalcon\Mvc\View\Engine\Php::class,
|
||||
]);
|
||||
return $view;
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue