]> BookStack Code Mirror - bookstack/blobdiff - app/Exports/ZipExports/Models/ZipExportBook.php
ZIP Imports: Added book content ordering to import preview
[bookstack] / app / Exports / ZipExports / Models / ZipExportBook.php
index 47ab8f0a699ce82f58fee261443eeae9b07e45ee..4f641d25bd71cd05025b4c95f5d90944ba3123b4 100644 (file)
@@ -36,6 +36,20 @@ class ZipExportBook extends ZipExportModel
         }
     }
 
+    public function children(): array
+    {
+        $children = [
+            ...$this->pages,
+            ...$this->chapters,
+        ];
+
+        usort($children, function ($a, $b) {
+            return ($a->priority ?? 0) - ($b->priority ?? 0);
+        });
+
+        return $children;
+    }
+
     public static function fromModel(Book $model, ZipExportFiles $files): self
     {
         $instance = new self();