This repository was archived by the owner on Sep 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModule.php
More file actions
77 lines (65 loc) · 2.21 KB
/
Module.php
File metadata and controls
77 lines (65 loc) · 2.21 KB
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
<?php
namespace DojoGrid;
use Zend\EventManager\EventInterface;
use Zend\ModuleManager\Feature\BootstrapListenerInterface;
use Zend\ModuleManager\Feature\ConfigProviderInterface;
use Zend\ModuleManager\Feature\DependencyIndicatorInterface;
use Zend\ModuleManager\Feature\InitProviderInterface;
use Zend\ModuleManager\ModuleManagerInterface;
use Zend\Mvc\MvcEvent;
use Zend\View\Renderer\RendererInterface;
/**
*
*/
class Module implements
ConfigProviderInterface,
InitProviderInterface,
BootstrapListenerInterface
{
public function getConfig()
{
return include __DIR__ . '/config/module.config.php';
}
/**
* @param EventInterface|MvcEvent $e
* @return array|void
*/
public function onBootstrap(EventInterface $e)
{
$serviceManager = $e->getApplication()->getServiceManager();
/** @var $as \AsseticBundle\Service */
$as = $serviceManager->get('AsseticService');
//Register the dext javascript files with assetic
$assetManager = $as->getAssetManager();
//Register the javascript assets
$rootDir = __DIR__ . DIRECTORY_SEPARATOR . 'assets';
\Dext\AsseticHelper::registerDir($assetManager, $rootDir);
/** @var $view RendererInterface */
$view = $serviceManager->get('viewmanager')->getRenderer();
/**
* @var $dojo \Dojo\View\Helper\Configuration
* Note that this is actually a \Dojo\View\Helper\Dojo object that we proxy to configuration.
*/
$dojo = $view->plugin('dojo');
$baseUrl = rtrim($as->getConfiguration()->getBaseUrl() . $as->getConfiguration()->getBasePath(), '/');
$dojo->registerPackagePath('dojoGrid', $baseUrl . '/js/dojoGrid');
}
public function getViewHelperConfig()
{
return array(
'factories' => array(
// the array key here is the name you will call the view helper by in your view scripts
'dojoGrid' => function($sm) {
return new \DojoGrid\View\Helper\Grid();
},
),
);
}
/**
* @inheritdoc
*/
public function init(ModuleManagerInterface $manager)
{
$manager->loadModule('Dext');
}
}