Skip to content

Commit e9bf84b

Browse files
committed
fix(section): order of sections not respected on import
Signed-off-by: Thierry Bugier <[email protected]>
1 parent 8b0c6b7 commit e9bf84b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

inc/form.class.php

+10
Original file line numberDiff line numberDiff line change
@@ -1931,6 +1931,16 @@ public static function import(PluginFormcreatorLinker $linker, $input = [], $con
19311931
// add the form to the linker
19321932
$linker->addObject($originalId, $item);
19331933

1934+
// sort sections
1935+
if (isset($input['_sections']) && is_array($input['_sections'])) {
1936+
usort($input['_sections'], function($a, $b) {
1937+
if ($a['order'] == $b['order']) {
1938+
return 0;
1939+
}
1940+
return ($a['order'] < $b['order']) ? -1 : 1;
1941+
});
1942+
}
1943+
19341944
$subItems = [
19351945
'_profiles' => PluginFormcreatorForm_Profile::class,
19361946
'_sections' => PluginFormcreatorSection::class,

0 commit comments

Comments
 (0)