forked from phly/PhlyBlog
/
Module.php
43 lines (36 loc) · 1017 Bytes
/
Module.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
namespace PhlyBlog;
use Traversable;
use Zend\Stdlib\ArrayUtils;
class Module
{
public static $config;
public function getAutoloaderConfig()
{
return array(
'Zend\Loader\ClassMapAutoloader' => array(
__DIR__ . '/autoload_classmap.php'
),
);
}
public function getConfig()
{
return include __DIR__ . '/config/module.config.php';
}
public function onBootstrap($e)
{
$app = $e->getApplication();
$services = $app->getServiceManager();
self::$config = $services->get('config');
if (self::$config instanceof Traversable) {
self::$config = ArrayUtils::iteratorToArray(self::$config);
}
}
public static function prepareCompilerView($view, $config, $services)
{
$renderer = $services->get('ViewRenderer');
$view->addRenderingStrategy(function($e) use ($renderer) {
return $renderer;
}, 100);
}
}