@@ -39,8 +39,10 @@ class DevtoolsModules extends BasePackage
3939
4040 public function addModule ($ data )
4141 {
42- if (isset ($ data ['module_type ' ]) &&
43- $ data ['module_type ' ] === 'components '
42+ if (!isset ($ data ['module_type ' ]) ||
43+ (isset ($ data ['module_type ' ]) &&
44+ ($ data ['module_type ' ] === 'components ' || $ data ['module_type ' ] === 'apps_types ' )
45+ )
4446 ) {
4547 $ ignoreChars = [' ' ];
4648 } else {
@@ -59,8 +61,6 @@ public function addModule($data)
5961 return true ;
6062 }
6163
62- $ data = $ this ->checkVersion ($ data );
63-
6464 $ data = $ this ->checkModuleTypeAndCategory ($ data );
6565
6666 $ data ['name ' ] = ucfirst (trim (str_replace ('(Clone) ' , '' , $ data ['name ' ])));
@@ -113,7 +113,7 @@ public function addModule($data)
113113 return false ;
114114 }
115115
116- if ($ data ['module_type ' ] !== 'views ' ) {
116+ if ($ data ['module_type ' ] !== 'views ' && $ data [ ' module_type ' ] !== ' components ' ) {
117117 $ moduleLocation = $ this ->getNewFilesLocation ($ data );
118118
119119 $ data ['class ' ] = rtrim (str_replace ('/ ' , '\\' , ucfirst ($ moduleLocation )), '\\' );
@@ -128,9 +128,9 @@ public function addModule($data)
128128 }
129129
130130 try {
131- if ($ this ->updateModuleJson ($ data ) &&
132- $ this ->generateNewFiles ($ data ) &&
133- $ this ->modules ->{ $ data [ ' module_type ' ]}-> add ($ data )
131+ if ($ this ->modules ->{ $ data [ ' module_type ' ]}-> add ($ data ) &&
132+ $ this ->updateModuleJson ($ data ) &&
133+ $ this ->generateNewFiles ($ data )
134134 ) {
135135 if ($ data ['createrepo ' ] == true ) {
136136 if ($ data ['module_type ' ] === 'views ' && $ data ['base_view_module_id ' ] == 0 ) {//Create public repository as well
@@ -191,8 +191,10 @@ public function addModule($data)
191191
192192 public function updateModule ($ data )
193193 {
194- if (isset ($ data ['module_type ' ]) &&
195- $ data ['module_type ' ] === 'components '
194+ if (!isset ($ data ['module_type ' ]) ||
195+ (isset ($ data ['module_type ' ]) &&
196+ ($ data ['module_type ' ] === 'components ' || $ data ['module_type ' ] === 'apps_types ' )
197+ )
196198 ) {
197199 $ ignoreChars = [' ' ];
198200 } else {
@@ -211,8 +213,6 @@ public function updateModule($data)
211213 return true ;
212214 }
213215
214- $ data = $ this ->checkVersion ($ data );
215-
216216 $ data = $ this ->checkModuleTypeAndCategory ($ data );
217217
218218 if ($ data ['module_type ' ] === 'bundles ' ) {
@@ -249,12 +249,27 @@ public function updateModule($data)
249249
250250 $ module = array_merge ($ module , $ data );
251251
252- if ($ this ->updateModuleJson ( $ data ) &&
253- $ this ->modules ->{ $ data [ ' module_type ' ]}-> update ( $ module )
252+ if ($ this ->modules ->{ $ data[ ' module_type ' ]}-> update ( $ module ) &&
253+ $ this ->updateModuleJson ( $ data )
254254 ) {
255255 if ($ data ['module_type ' ] === 'components ' ) {
256256 $ this ->addUpdateComponentMenu ($ data );
257257 }
258+ if ($ data ['module_type ' ] === 'views ' ) {
259+ $ viewsSettings = $ this ->modules ->viewsSettings ->getViewsSettingsByViewId ($ data ['id ' ]);
260+
261+ if ($ viewsSettings ) {
262+ foreach ($ viewsSettings as $ setting ) {
263+ if (is_string ($ data ['settings ' ])) {
264+ $ data ['settings ' ] = $ this ->helper ->decode ($ data ['settings ' ], true );
265+ }
266+
267+ $ setting ['settings ' ] = array_replace ($ setting ['settings ' ], $ data ['settings ' ]);
268+
269+ $ this ->modules ->viewsSettings ->updateViewsSettings ($ setting );
270+ }
271+ }
272+ }
258273
259274 if ($ data ['createrepo ' ] == true ) {
260275 if (!$ this ->checkRepo ($ data )) {
@@ -2211,7 +2226,7 @@ public function generateModuleRepoUrl($data)
22112226 $ baseView = $ this ->modules ->views ->getViewById ($ data ['base_view_module_id ' ]);
22122227 }
22132228
2214- if ($ data ['module_type ' ] === 'components ' ) {
2229+ if ($ data ['module_type ' ] === 'components ' || $ data [ ' module_type ' ] === ' apps_types ' ) {
22152230 $ ignoreChars = [' ' ];
22162231 } else {
22172232 $ ignoreChars = ['' ];
0 commit comments