Skip to content

Commit

Permalink
fix(section): order of sections not respected on import
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <[email protected]>
  • Loading branch information
btry committed Aug 10, 2020
1 parent e43bf45 commit 0e27cb3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions inc/form.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1957,6 +1957,14 @@ public static function import(PluginFormcreatorLinker $linker, $input = [], $con
// add the form to the linker
$linker->addObject($originalId, $item);

// sort sections
usort($input['_sections'], function($a, $b) {
if ($a['order'] == $b['order']) {
return 0;
}
return ($a['order'] < $b['order']) ? -1 : 1;
});

$subItems = [
'_profiles' => PluginFormcreatorForm_Profile::class,
'_sections' => PluginFormcreatorSection::class,
Expand Down

0 comments on commit 0e27cb3

Please sign in to comment.