Moving Url and Doctype view helpers setup to module configuration. Also, adding vario...
[zf2.biz/galerie.git] / module / Application / config / module.config.php
1 <?php
2 return array(
3     'di' => array(
4
5         'definition' => array(
6             'class' => array(
7                 // Defining how the router should be instantiated. The minimum
8                 // requirement is to implement interface 
9                 // Zend\Mvc\Router\RouteStack. Here we are stating that 
10                 // Zend\Mvc\Router\Http\TreeRouteStack::factory should generate
11                 // an instance of it. This can be changed to instantiate a
12                 // custom router
13                 'Zend\Mvc\Router\RouteStack' => array(
14                     'instantiator' => array(
15                         'Zend\Mvc\Router\Http\TreeRouteStack',
16                         'factory'
17                     ),
18                 ),
19             ),
20         ),
21
22         'instance' => array(
23
24             // Setup for controllers.
25
26             // Injecting the plugin broker for controller plugins into
27             // the action controller for use by all controllers that
28             // extend it
29             'Zend\Mvc\Controller\ActionController' => array(
30                 'parameters' => array(
31                     'broker'       => 'Zend\Mvc\Controller\PluginBroker',
32                 ),
33             ),
34             'Zend\Mvc\Controller\PluginBroker' => array(
35                 'parameters' => array(
36                     'loader' => 'Zend\Mvc\Controller\PluginLoader',
37                 ),
38             ),
39
40             // Setup for router and routes
41             'Zend\Mvc\Router\RouteStack' => array(
42                 'parameters' => array(
43                     'routes' => array(
44                         'default' => array(
45                             'type'    => 'Zend\Mvc\Router\Http\Segment',
46                             'options' => array(
47                                 'route'    => '/[:controller[/:action]]',
48                                 'constraints' => array(
49                                     'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
50                                     'action'     => '[a-zA-Z][a-zA-Z0-9_-]*',
51                                 ),
52                                 'defaults' => array(
53                                     'controller' => 'Application\Controller\IndexController',
54                                     'action'     => 'index',
55                                 ),
56                             ),
57                         ),
58                         'home' => array(
59                             'type' => 'Zend\Mvc\Router\Http\Literal',
60                             'options' => array(
61                                 'route'    => '/',
62                                 'defaults' => array(
63                                     'controller' => 'Application\Controller\IndexController',
64                                     'action'     => 'index',
65                                 ),
66                             ),
67                         ),
68                     ),
69                 ),
70             ),
71
72             // Setup for the view layer.
73
74             // Using the PhpRenderer, which just handles html produced by php 
75             // scripts
76             'Zend\View\Renderer\PhpRenderer' => array(
77                 'parameters' => array(
78                     'resolver' => 'Zend\View\Resolver\AggregateResolver',
79                 ),
80             ),
81             // Defining how the view scripts should be resolved by stacking up
82             // a Zend\View\Resolver\TemplateMapResolver and a
83             // Zend\View\Resolver\TemplatePathStack
84             'Zend\View\Resolver\AggregateResolver' => array(
85                 'injections' => array(
86                     'Zend\View\Resolver\TemplateMapResolver',
87                     'Zend\View\Resolver\TemplatePathStack',
88                 ),
89             ),
90             // Defining where the layout/layout view should be located
91             'Zend\View\Resolver\TemplateMapResolver' => array(
92                 'parameters' => array(
93                     'map'  => array(
94                         'layout/layout' => __DIR__ . '/../view/layout/layout.phtml',
95                     ),
96                 ),
97             ),
98             // Defining where to look for views. This works with multiple paths,
99             // very similar to include_path
100             'Zend\View\Resolver\TemplatePathStack' => array(
101                 'parameters' => array(
102                     'paths'  => array(
103                         'application' => __DIR__ . '/../view',
104                     ),
105                 ),
106             ),
107             // View for the layout
108             'Zend\Mvc\View\DefaultRenderingStrategy' => array(
109                 'parameters' => array(
110                     'layoutTemplate' => 'layout/layout',
111                 ),
112             ),
113             // Injecting the router into the url helper
114             'Zend\View\Helper\Url' => array(
115                 'parameters' => array(
116                     'router' => 'Zend\Mvc\Router\RouteStack',
117                 ),
118             ),
119             // Configuration for the doctype helper
120             'Zend\View\Helper\Doctype' => array(
121                 'parameters' => array(
122                     'doctype' => 'HTML5',
123                 ),
124             ),
125             // View script rendered in case of 404 exception
126             'Zend\Mvc\View\RouteNotFoundStrategy' => array(
127                 'parameters' => array(
128                     'displayNotFoundReason' => true,
129                     'displayExceptions'     => true,
130                     'notFoundTemplate'      => 'error/404',
131                 ),
132             ),
133             // View script rendered in case of other exceptions
134             'Zend\Mvc\View\ExceptionStrategy' => array(
135                 'parameters' => array(
136                     'displayExceptions' => true,
137                     'exceptionTemplate' => 'error/index',
138                 ),
139             ),
140         ),
141     ),
142 );