PhotoPage: make prev/next photo logic more direct

This commit is contained in:
2024-01-11 18:54:54 +01:00
parent 507357ba59
commit bc08e867f0
3 changed files with 20 additions and 35 deletions

View File

@@ -40,17 +40,8 @@ class ViewPhoto extends HTMLController
// What tag are we browsing?
$tag = isset($_GET['in']) ? Tag::fromId($_GET['in']) : null;
$id_tag = isset($tag) ? $tag->id_tag : null;
// Find previous photo in set.
$previous_url = $photo->getUrlForPreviousInSet($id_tag);
if ($previous_url)
$page->setPreviousPhotoUrl($previous_url);
// ... and the next photo, too.
$next_url = $photo->getUrlForNextInSet($id_tag);
if ($next_url)
$page->setNextPhotoUrl($next_url);
if (isset($tag))
$page->setTag($tag);
$this->page->adopt($page);
$this->page->setCanonicalUrl($photo->getPageUrl());