ViewPhotoAlbum: don't populate filter box if there are no album contributors

This commit is contained in:
Aaron van Geffen 2024-01-14 22:17:09 +01:00
parent 99b867b241
commit 9c00248a7f
2 changed files with 24 additions and 15 deletions

View File

@ -47,7 +47,10 @@ class ViewPhotoAlbum extends HTMLController
$contributors = $tag->getContributorList();
// Enumerate possible filters
$filters = ['' => ['id_user' => null, 'caption' => 'Show all photos', 'link' => $tag->getUrl()]];
$filters = [];
if (!empty($contributors))
{
$filters[''] = ['id_user' => null, 'caption' => 'Show all photos', 'link' => $tag->getUrl()];
foreach ($contributors as $contributor)
{
$filters[$contributor['slug']] = [
@ -57,6 +60,7 @@ class ViewPhotoAlbum extends HTMLController
'link' => $tag->getUrl() . '/?by=' . $contributor['slug'],
];
}
}
// Limit to a particular uploader?
$active_filter = '';

View File

@ -28,6 +28,8 @@ class AlbumButtonBox extends Template
echo '
<a class="btn btn-light" href="', $button['url'], '">', $button['caption'], '</a>';
if (!empty($this->filters))
{
echo '
<div class="dropdown">
<button class="btn btn-light dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
@ -47,7 +49,10 @@ class AlbumButtonBox extends Template
echo '
</ul>
</div>
</div>';
}
echo '
</div>';
}
}