@@ -30,17 +30,17 @@ public function load(array $configs, ContainerBuilder $container)
30
30
$ loader ->load ('controllers.yml ' );
31
31
$ loader ->load ('services.yml ' );
32
32
33
- $ activatedBundles = array_keys ( $ container ->getParameter ('kernel.bundles ' ) );
33
+ $ activatedBundles = $ container ->getParameter ('kernel.bundles ' );
34
34
35
- if (!in_array ('EzCoreExtraBundle ' , $ activatedBundles, true )) {
35
+ if (!array_key_exists ('EzCoreExtraBundle ' , $ activatedBundles )) {
36
36
throw new RuntimeException ('Netgen Admin UI Bundle requires EzCoreExtraBundle (lolautruche/ez-core-extra-bundle) to be activated to work properly. ' );
37
37
}
38
38
39
- if (class_exists ( ' Netgen\TagsBundle\Version ' ) && TagsBundleVersion:: MAJOR_VERSION >= 3 ) {
39
+ if ($ this -> hasTags ( $ activatedBundles ) ) {
40
40
$ loader ->load ('tags/services.yml ' );
41
41
}
42
42
43
- if ($ this ->hasLayouts ($ container )) {
43
+ if ($ this ->hasLayouts ($ activatedBundles )) {
44
44
$ loader ->load ('layouts/controllers.yml ' );
45
45
}
46
46
@@ -61,7 +61,7 @@ public function prepend(ContainerBuilder $container)
61
61
'framework/twig.yml ' => 'twig ' ,
62
62
);
63
63
64
- if ($ this ->hasLayouts ($ container )) {
64
+ if ($ this ->hasLayouts ($ container-> getParameter ( ' kernel.bundles ' ) )) {
65
65
$ configs ['layouts/view.yml ' ] = 'netgen_block_manager ' ;
66
66
}
67
67
@@ -76,11 +76,11 @@ public function prepend(ContainerBuilder $container)
76
76
/**
77
77
* Returns if Netgen Layouts is active or not.
78
78
*
79
- * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
79
+ * @param array $activatedBundles
80
80
*
81
81
* @return bool
82
82
*/
83
- protected function hasLayouts (ContainerBuilder $ container )
83
+ protected function hasLayouts (array $ activatedBundles )
84
84
{
85
85
if (!class_exists ('Netgen\BlockManager\Version ' )) {
86
86
return false ;
@@ -90,8 +90,26 @@ protected function hasLayouts(ContainerBuilder $container)
90
90
return false ;
91
91
}
92
92
93
- $ activatedBundles = $ container ->getParameter ('kernel.bundles ' );
94
-
95
93
return array_key_exists ('NetgenBlockManagerBundle ' , $ activatedBundles );
96
94
}
95
+
96
+ /**
97
+ * Returns if Netgen Tags v3+ is active or not.
98
+ *
99
+ * @param array $activatedBundles
100
+ *
101
+ * @return bool
102
+ */
103
+ protected function hasTags (array $ activatedBundles )
104
+ {
105
+ if (!class_exists ('Netgen\TagsBundle\Version ' )) {
106
+ return false ;
107
+ }
108
+
109
+ if (TagsBundleVersion::MAJOR_VERSION < 3 ) {
110
+ return false ;
111
+ }
112
+
113
+ return array_key_exists ('NetgenTagsBundle ' , $ activatedBundles );
114
+ }
97
115
}
0 commit comments