@@ -53,17 +53,23 @@ function __construct(modX &$modx, array $config = [])
53
53
*/
54
54
public function getOption (string $ key , $ options = [], $ default = null )
55
55
{
56
- $ option = $ default ;
57
- if (!empty ($ key ) && is_string ($ key )) {
58
- if ($ options != null && array_key_exists ($ key , $ options )) {
59
- $ option = $ options [$ key ];
60
- } elseif (array_key_exists ($ key , $ this ->config )) {
61
- $ option = $ this ->config [$ key ];
62
- } elseif (array_key_exists ("{$ this ->namespace }. {$ key }" , $ this ->modx ->config )) {
63
- $ option = $ this ->modx ->getOption ("{$ this ->namespace }. {$ key }" );
64
- }
56
+ if (empty ($ key ) || !is_string ($ key )) {
57
+ return $ default ;
65
58
}
66
- return $ option ;
59
+
60
+ if (!empty ($ options ) && array_key_exists ($ key , $ options )) {
61
+ return $ options [$ key ];
62
+ }
63
+
64
+ if (array_key_exists ($ key , $ this ->config )) {
65
+ return $ this ->config [$ key ];
66
+ }
67
+
68
+ if (array_key_exists ("{$ this ->namespace }. {$ key }" , $ this ->modx ->config )) {
69
+ return $ this ->modx ->getOption ("{$ this ->namespace }. {$ key }" );
70
+ }
71
+
72
+ return $ default ;
67
73
}
68
74
69
75
public function getListOfTVs ()
@@ -126,4 +132,20 @@ public function getAPIUrl()
126
132
{
127
133
return $ this ->config ['assetsUrl ' ] . 'api.php ' ;
128
134
}
135
+
136
+ public function getJSFile ()
137
+ {
138
+ $ lit = $ this ->getLit ();
139
+ $ assetsUrl = $ this ->getOption ('assetsUrl ' );
140
+
141
+ return "{$ assetsUrl }js/modai.js?lit= $ lit " ;
142
+ }
143
+
144
+ public function getCSSFile ()
145
+ {
146
+ $ lit = $ this ->getLit ();
147
+ $ assetsUrl = $ this ->getOption ('assetsUrl ' );
148
+
149
+ return "{$ assetsUrl }css/modai.css?lit= $ lit " ;
150
+ }
129
151
}
0 commit comments