@@ -363,7 +363,7 @@ public static function processTemplateSettings($template)
363363 foreach ($ parsedProperties as $ index => &$ property ) {
364364 $ property ['id ' ] = $ index ;
365365
366- if (isset ($ property ['options ' ])) {
366+ if (isset ($ property ['options ' ]) && is_array ( $ property [ ' options ' ]) ) {
367367 $ property ['options ' ] = self ::dropDownOptionsToString ($ property ['options ' ]);
368368 }
369369 }
@@ -408,18 +408,26 @@ protected static function preprocessPropertyValues($theme, $snippetCode, $compon
408408
409409 /**
410410 * Converts a keyed object to an array, converting the index to the "property" value.
411- * @return array
412411 */
413- protected static function parseIniProperties ($ properties )
412+ protected static function parseIniProperties ($ properties ): array
414413 {
415414 foreach ($ properties as $ index => $ value ) {
416- $ properties [$ index ]['property ' ] = $ index ;
415+ if (!is_array ($ value ['options ' ])) {
416+ $ value ['options ' ] = self ::dropDownOptionsToArray ($ value ['options ' ]);
417+ }
418+
419+ if (is_int ($ index )) {
420+ $ properties [$ value ['property ' ]] = $ value ;
421+ unset($ properties [$ index ]);
422+ } elseif (is_string ($ index )) {
423+ $ properties [$ index ]['property ' ] = $ index ;
424+ }
417425 }
418426
419427 return array_values ($ properties );
420428 }
421429
422- protected static function dropDownOptionsToArray ($ optionsString )
430+ protected static function dropDownOptionsToArray (string $ optionsString ): array
423431 {
424432 $ options = explode ('| ' , $ optionsString );
425433
@@ -447,7 +455,7 @@ protected static function dropDownOptionsToArray($optionsString)
447455 return $ result ;
448456 }
449457
450- protected static function dropDownOptionsToString ($ optionsArray )
458+ protected static function dropDownOptionsToString (array $ optionsArray )
451459 {
452460 $ result = [];
453461 $ isAssoc = (bool ) count (array_filter (array_keys ($ optionsArray ), 'is_string ' ));
0 commit comments