From b774a07e3039b5c1d4fe65baf5df4514af1d79c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Tue, 14 Jul 2020 15:05:29 +0200 Subject: [PATCH] Fix sorting children --- tests/Feature/PdfMaker/PdfMakerUtilities.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/Feature/PdfMaker/PdfMakerUtilities.php b/tests/Feature/PdfMaker/PdfMakerUtilities.php index bc1a03cb7d65..6672ffa7b584 100644 --- a/tests/Feature/PdfMaker/PdfMakerUtilities.php +++ b/tests/Feature/PdfMaker/PdfMakerUtilities.php @@ -64,11 +64,11 @@ trait PdfMakerUtilities $processed[] = $child; } - + usort($processed, function ($a, $b) { return $a['order'] <=> $b['order']; }); - + return $processed; } @@ -86,7 +86,6 @@ trait PdfMakerUtilities public function createElementContent($element, $children) { foreach ($children as $child) { - // info($child); $_child = $this->document->createElement($child['element'], $child['content']); $element->appendChild($_child); @@ -98,7 +97,9 @@ trait PdfMakerUtilities } if (isset($child['elements'])) { - $this->createElementContent($_child, $child['elements']); + $sorted = $this->processChildrenOrder($child['elements']); + + $this->createElementContent($_child, $sorted); } } }