ViewPhoto: take filter into account for prev/next links
This commit is contained in:
@@ -46,6 +46,19 @@ class ViewPhoto extends HTMLController
|
||||
if (isset($tag))
|
||||
$page->setTag($tag);
|
||||
|
||||
// Keeping tabs on a filter?
|
||||
if (isset($_GET['by']))
|
||||
{
|
||||
// Let's first verify that the filter is valid
|
||||
$contributors = array_filter($tag->getContributorList(), fn($el) => $el['slug'] === $_GET['by']);
|
||||
if (count($contributors) !== 1)
|
||||
throw new UnexpectedValueException('Invalid filter for this album or tag.');
|
||||
|
||||
// Alright, let's run with it then
|
||||
$filter = reset($contributors);
|
||||
$page->setActiveFilter($filter['slug']);
|
||||
}
|
||||
|
||||
$this->page->adopt($page);
|
||||
$this->page->setCanonicalUrl($this->photo->getPageUrl());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user