1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @file |
4
|
|
|
* Main module file for the service_container module. |
5
|
|
|
*/ |
6
|
|
|
|
7
|
|
|
// ----------------------------------------------------------------------- |
8
|
|
|
// Core Hooks |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Implements hook_stream_wrappers_alter(). |
12
|
|
|
*/ |
13
|
|
|
function service_container_stream_wrappers_alter(&$wrappers) { |
|
|
|
|
14
|
|
|
if (class_exists('ServiceContainer')) { |
15
|
|
|
ServiceContainer::init(); |
16
|
|
|
} |
17
|
|
|
} |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Implements hook_modules_enabled(). |
21
|
|
|
*/ |
22
|
|
|
function service_container_modules_enabled() { |
23
|
|
|
if (class_exists('ServiceContainer')) { |
24
|
|
|
ServiceContainer::reset(); |
25
|
|
|
ServiceContainer::init(); |
26
|
|
|
} |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Implements hook_module_implements_alter(). |
31
|
|
|
*/ |
32
|
|
|
function service_container_module_implements_alter(&$implementations, $hook) { |
33
|
|
|
// Moves our hook_init() implementation to occur first so that we |
34
|
|
|
// can initialize the container. |
35
|
|
|
if ($hook == 'stream_wrappers_alter') { |
36
|
|
|
$group = $implementations['service_container']; |
37
|
|
|
unset($implementations['service_container']); |
38
|
|
|
$implementations = array('service_container' => $group) + $implementations; |
39
|
|
|
} |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
// ----------------------------------------------------------------------- |
43
|
|
|
// Contrib Hooks |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Implements hook_ctools_plugin_type(). |
47
|
|
|
*/ |
48
|
|
|
function service_container_ctools_plugin_type() { |
49
|
|
|
$items['ServiceProvider'] = array( |
|
|
|
|
50
|
|
|
'cache' => FALSE, |
51
|
|
|
); |
52
|
|
|
|
53
|
|
|
return $items; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Implements hook_ctools_plugin_directory(). |
58
|
|
|
*/ |
59
|
|
|
function service_container_ctools_plugin_directory($owner, $plugin_type) { |
60
|
|
|
if ($owner == 'service_container') { |
61
|
|
|
return 'src/ServiceContainer/' . $plugin_type; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
return NULL; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
// ----------------------------------------------------------------------- |
68
|
|
|
// Public API |
69
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.