Skip to content

Commit

Permalink
Fix broken sorting by filename in media browser
Browse files Browse the repository at this point in the history
Fixes #9
  • Loading branch information
kdambekalns committed Feb 16, 2022
1 parent b56a368 commit 85922c2
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Classes/Service/PixxioClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
use Neos\Media\Domain\Model\AssetSource\SupportsSortingInterface;
use Psr\Http\Message\ResponseInterface;


/**
* Pixx.io API client
*/
Expand Down Expand Up @@ -198,7 +197,7 @@ public function updateFile(string $id, array $metadata): ResponseInterface
* @return ResponseInterface
* @throws ConnectionException
*/
public function search(string $queryExpression, array $formatTypes, array $fileTypes, string $assetCollectionFilter = null, int $offset = 0, int $limit = 50, $orderings = []): ResponseInterface
public function search(string $queryExpression, array $formatTypes, array $fileTypes, string $assetCollectionFilter = null, int $offset = 0, int $limit = 50, array $orderings = []): ResponseInterface
{
$options = new \stdClass();
$options->pagination = $limit . '-' . (int)($offset / $limit + 1);
Expand All @@ -215,9 +214,9 @@ public function search(string $queryExpression, array $formatTypes, array $fileT
$options->searchTerm = urlencode($queryExpression);
}

if (isset($orderings['filename'])) {
$options->sortBy = 'filename';
$options->sortDirection = ($orderings['filename'] === SupportsSortingInterface::ORDER_DESCENDING) ? 'descending' : 'ascending';
if (isset($orderings['resource.filename'])) {
$options->sortBy = 'fileName';
$options->sortDirection = ($orderings['resource.filename'] === SupportsSortingInterface::ORDER_DESCENDING) ? 'descending' : 'ascending';
}

if (isset($orderings['lastModified'])) {
Expand Down

0 comments on commit 85922c2

Please sign in to comment.