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
76 lines (62 loc) · 2.05 KB
/
Module.php
File metadata and controls
76 lines (62 loc) · 2.05 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
<?php
namespace Dext;
use Zend\EventManager\EventInterface;
use Zend\ModuleManager\Feature\BootstrapListenerInterface;
use Zend\ModuleManager\Feature\ConfigProviderInterface;
use Zend\ModuleManager\Feature\InitProviderInterface;
use Zend\ModuleManager\ModuleManager;
use Zend\ModuleManager\ModuleManagerInterface;
use Zend\Mvc\MvcEvent;
/**
*
*/
class Module implements
ConfigProviderInterface,
InitProviderInterface,
BootstrapListenerInterface
{
public function getConfig()
{
return include __DIR__ . '/config/module.config.php';
}
/**
* {@inheritDoc}
*/
public function init(ModuleManagerInterface $moduleManager)
{
$moduleManager->loadModule('Dojo');
$moduleManager->loadModule('AsseticBundle');
}
/**
* @param MvcEvent|EventInterface $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();
$this->_registerDextAssets($assetManager);
/** @var $view \Zend\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('dext', $baseUrl . '/js/dext');
}
/**
* Registers all files in the asset directory with assetic.
*
* @param \Assetic\AssetManager $am
*/
private function _registerDextAssets(\Assetic\AssetManager $am)
{
$rootDir = __DIR__ . DIRECTORY_SEPARATOR . 'assets';
AsseticHelper::registerDir($am, $rootDir);
}
}