Skip to content

Commit

Permalink
IBX-6540: Added Depth sort to breadcrumbs (#2115)
Browse files Browse the repository at this point in the history
* IBX-6540: Added Depth sort to breadcrumbs

Signed-off-by: Dawid Parafiński <[email protected]>

* Update src/lib/QueryType/LocationPathQueryType.php

Co-authored-by: Mikolaj Adamczyk <[email protected]>

---------

Signed-off-by: Dawid Parafiński <[email protected]>
Co-authored-by: Mikolaj Adamczyk <[email protected]>
  • Loading branch information
ViniTou and mikadamczyk authored Mar 12, 2024
1 parent b0db6f5 commit 80eeb14
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib/QueryType/LocationPathQueryType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 80eeb14

Please sign in to comment.