X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=module%2FApplication%2FModule.php;h=75282d944d5e5cadb7a0120411c0feedafb13d72;hb=8511c4ef382e917cadc559b30214610500bf3cae;hp=6318f22223f140f58221a63d5804cafd31b89167;hpb=26b842365013594ee6c41c1c83c3b07adc9f753c;p=zf2.biz%2Fapplication_blanche.git diff --git a/module/Application/Module.php b/module/Application/Module.php index 6318f22..75282d9 100644 --- a/module/Application/Module.php +++ b/module/Application/Module.php @@ -39,53 +39,11 @@ class Module implements AutoloaderProvider public function initializeView($e) { $app = $e->getParam('application'); + $basePath = $app->getRequest()->getBasePath(); $locator = $app->getLocator(); - $config = $e->getParam('config'); - $view = $this->getView($app); - $viewListener = $this->getViewListener($view, $config); - $app->events()->attachAggregate($viewListener); - $events = StaticEventManager::getInstance(); - $viewListener->registerStaticListeners($events, $locator); - } - - protected function getViewListener($view, $config) - { - if ($this->viewListener instanceof View\Listener) { - return $this->viewListener; - } - - $viewListener = new View\Listener($view, $config->layout); - $viewListener->setDisplayExceptionsFlag($config->display_exceptions); - - $this->viewListener = $viewListener; - return $viewListener; - } - - protected function getView($app) - { - if ($this->view) { - return $this->view; - } - - $location = $app->getLocator(); - $view = $di->get('view'); - $url = $view->plugin('url'); - $url->setRouter($app->getRouter()); - - $view->plugin('headTitle')->setSeparator(' - ') - ->setAutoEscape(false) - ->append('ZF2 Skeleton Application'); - - $basePath = $app->getRequest()->detectBaseUrl(); - - $view->plugin('headLink')->appendStylesheet($basePath . 'css/bootstrap.min.css'); - - $html5js = ''; - $view->plugin('placeHolder')->__invoke('html5js')->set($html5js); - $favicon = ''; - $view->plugin('placeHolder')->__invoke('favicon')->set($favicon); - - $this->view = $view; - return $view; + $renderer = $locator->get('Zend\View\Renderer\PhpRenderer'); + $renderer->plugin('url')->setRouter($app->getRouter()); + $renderer->doctype()->setDoctype('HTML5'); + $renderer->plugin('basePath')->setBasePath($basePath); } }