Skip to content

Commit

Permalink
Pagination fix
Browse files Browse the repository at this point in the history
  • Loading branch information
janhenckens committed Feb 12, 2024
1 parent f3fa61a commit 402372d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Splashing Images changelog

## 5.0.2 - 2024-02-12
## Fixed
- Fixed an issue with pagination when searching

## 5.0.1 - 2024-02-11
## Fixed
- Fixed an error with multiple search terms ([#16](https://github.com/studioespresso/craft-unsplash/issues/16))
Expand All @@ -12,6 +16,10 @@
### Added
- Initial Craft 5 support

## 3.0.2 - 2024-02-11
### Fixed
- Fixed an issue with pagination when searching

## 3.0.1 - 2024-02-11
### Fixed
- Fixed an error with multiple search terms ([#16](https://github.com/studioespresso/craft-unsplash/issues/16))
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "studioespresso/craft-splashingimages",
"description": "unsplash.com integration for Craft CMS",
"type": "craft-plugin",
"version": "5.0.1",
"version": "5.0.2",
"keywords": [
"craft",
"cms",
Expand Down
3 changes: 2 additions & 1 deletion src/services/UnsplashService.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

use Craft;
use craft\base\Component;
use craft\helpers\UrlHelper;
use Unsplash\HttpClient;
use Unsplash\Photo;
use Unsplash\Search;
Expand Down Expand Up @@ -72,7 +73,7 @@ public function search($query, $page = 1, $count = 30)

$results = $this->parseResults($images->getArrayObject());
$data['images'] = $results;
$data['next_page'] = $this->getNextUrl();
$data['next_page'] = UrlHelper::cpUrl($this->getNextUrl(), ['search' => $query]);
Craft::$app->cache->add('splashing_' . $query . '_' . $page, $data, 60 * 60 * 24);
return $data;
}
Expand Down

0 comments on commit 402372d

Please sign in to comment.