| @@ -83,8 +83,14 @@ | ||
| 83 | 83 | */ |
| 84 | 84 | public function sort($sortBy = 'index') |
| 85 | 85 | { |
| 86 | 86 | foreach ($this->items as $group => &$items) { |
| 87 | + // NOTE: usort renumbers the groups 0..n, which is deliberate - the | |
| 88 | + // editor receives these as JSON and editor-inserter.vue declares | |
| 89 | + // generalMockList/advancedMockList/containerMockList as Array props, | |
| 90 | + // so they must not become JSON objects. Consumers that need to look | |
| 91 | + // an element up by name must re-key it themselves (see | |
| 92 | + // AiFormBuilder::getDefaultFields). | |
| 87 | 93 | usort($items, function ($a, $b) { |
| 88 | 94 | if (@$a['index'] == @$b['index']) { |
| 89 | 95 | return 0; |
| 90 | 96 | } |