From 80eeb14221d5db40e91e5262718beef78007013f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Parafi=C5=84ski?= Date: Tue, 12 Mar 2024 13:32:50 +0100 Subject: [PATCH] IBX-6540: Added Depth sort to breadcrumbs (#2115) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * IBX-6540: Added Depth sort to breadcrumbs Signed-off-by: Dawid Parafiński * Update src/lib/QueryType/LocationPathQueryType.php Co-authored-by: Mikolaj Adamczyk --------- Signed-off-by: Dawid Parafiński Co-authored-by: Mikolaj Adamczyk --- src/lib/QueryType/LocationPathQueryType.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/QueryType/LocationPathQueryType.php b/src/lib/QueryType/LocationPathQueryType.php index a1cc29237b..4765aa7f75 100644 --- a/src/lib/QueryType/LocationPathQueryType.php +++ b/src/lib/QueryType/LocationPathQueryType.php @@ -11,6 +11,7 @@ use eZ\Publish\API\Repository\Values\Content\Location; use eZ\Publish\API\Repository\Values\Content\LocationQuery; use eZ\Publish\API\Repository\Values\Content\Query; +use eZ\Publish\API\Repository\Values\Content\Query\SortClause\Location\Depth; use eZ\Publish\Core\QueryType\OptionsResolverBasedQueryType; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -42,7 +43,10 @@ protected function doGetQuery(array $parameters): Query ? new Query\Criterion\ParentLocationId($rootLocationId) : new Query\Criterion\LocationId($this->getParentLocationPath($location)); - return new LocationQuery(['filter' => $filter]); + return new LocationQuery([ + 'filter' => $filter, + 'sortClauses' => [new Depth()], + ]); } private function getParentLocationPath(Location $location): array