-
Notifications
You must be signed in to change notification settings - Fork 0
/
Module.php
89 lines (78 loc) · 1.92 KB
/
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
/**
* ScWidgets (https://github.com/dphn/ScWidgets)
*
* @author Dolphin <[email protected]>
* @copyright Copyright (c) 2013-2014 ScContent
* @link https://github.com/dphn/ScWidgets
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
namespace ScWidgets;
use ZfcBase\Module\AbstractModule,
Zend\Mvc\MvcEvent;
if (0 > version_compare(phpversion(), '5.4.0')) {
exit(
'The module ScWidgets need PHP version >= 5.4.0'
);
}
/**
* Short alias for DIRECTORY_SEPARATOR
*
* @const string
*/
defined('DS') || define('DS', DIRECTORY_SEPARATOR);
/**
* @author Dolphin <[email protected]>
*/
class Module extends AbstractModule
{
/**
* @return string
*/
public function getDir()
{
return __DIR__;
}
/**
* @return string
*/
public function getNamespace()
{
return __NAMESPACE__;
}
/**
* @param Zend\Mvc\MvcEvent $event
* @return void
*/
public function onBootstrap(MvcEvent $event)
{
$app = $event->getApplication();
$serviceLocator = $app->getServiceManager();
// Example of using ScContent installation feature
$installation = require $this->getDir()
. str_replace('/', DS, '/config/installation.config.php');
$serviceLocator->get('ScListener.Installation.Inspector')
->setup(__NAMESPACE__, $installation);
}
/**
* @return array
*/
public function getServiceConfig()
{
return include __DIR__ . DS . 'config' . DS . 'services.config.php';
}
/**
* @return array
*/
public function getControllerConfig()
{
return include __DIR__ . DS . 'config' . DS . 'controllers.config.php';
}
/**
* @return array
*/
public function getFormElementConfig()
{
return include __DIR__ . DS . 'config' . DS . 'form.elements.config.php';
}
}