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

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

View File

@@ -47,15 +47,19 @@ class ViewPhotoAlbum extends HTMLController
$contributors = $tag->getContributorList();
// Enumerate possible filters
$filters = ['' => ['id_user' => null, 'caption' => 'Show all photos', 'link' => $tag->getUrl()]];
foreach ($contributors as $contributor)
$filters = [];
if (!empty($contributors))
{
$filters[$contributor['slug']] = [
'id_user' => $contributor['id_user'],
'caption' => sprintf('By %s (%s photos)',
$contributor['first_name'], $contributor['num_assets']),
'link' => $tag->getUrl() . '/?by=' . $contributor['slug'],
];
$filters[''] = ['id_user' => null, 'caption' => 'Show all photos', 'link' => $tag->getUrl()];
foreach ($contributors as $contributor)
{
$filters[$contributor['slug']] = [
'id_user' => $contributor['id_user'],
'caption' => sprintf('By %s (%s photos)',
$contributor['first_name'], $contributor['num_assets']),
'link' => $tag->getUrl() . '/?by=' . $contributor['slug'],
];
}
}
// Limit to a particular uploader?