From a09940ef6abfe803ba7e0e240ecc75e0be671bf0 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Thu, 24 Jan 2019 16:20:51 +0200 Subject: [PATCH] Added `FlexCollection::sort()` method --- system/src/Grav/Framework/Flex/FlexCollection.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/system/src/Grav/Framework/Flex/FlexCollection.php b/system/src/Grav/Framework/Flex/FlexCollection.php index 9e4d4a373..ccbaf7694 100644 --- a/system/src/Grav/Framework/Flex/FlexCollection.php +++ b/system/src/Grav/Framework/Flex/FlexCollection.php @@ -117,6 +117,13 @@ class FlexCollection extends ObjectCollection implements FlexCollectionInterface return $type . $this->_flexDirectory->getType(); } + public function sort(array $order) // : FlexCollection + { + $criteria = Criteria::create()->orderBy($order); + + return $this->matching($criteria); + } + /** * Twig example: {% render collection layout 'edit' with {my_check: true} %} *