From 402372dfe04c2d0e4fd31663fbb8047faee4549b Mon Sep 17 00:00:00 2001 From: Jan Henckens Date: Mon, 12 Feb 2024 15:36:45 +0100 Subject: [PATCH] Pagination fix --- CHANGELOG.md | 8 ++++++++ composer.json | 2 +- src/services/UnsplashService.php | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c1abe5..3821d24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) @@ -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)) diff --git a/composer.json b/composer.json index fae7a8c..e219d72 100644 --- a/composer.json +++ b/composer.json @@ -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", diff --git a/src/services/UnsplashService.php b/src/services/UnsplashService.php index 1622070..788c09e 100644 --- a/src/services/UnsplashService.php +++ b/src/services/UnsplashService.php @@ -12,6 +12,7 @@ use Craft; use craft\base\Component; +use craft\helpers\UrlHelper; use Unsplash\HttpClient; use Unsplash\Photo; use Unsplash\Search; @@ -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; }