diff --git a/controllers/ViewPhotoAlbum.php b/controllers/ViewPhotoAlbum.php index 0ff4129..c15175e 100644 --- a/controllers/ViewPhotoAlbum.php +++ b/controllers/ViewPhotoAlbum.php @@ -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? diff --git a/templates/AlbumButtonBox.php b/templates/AlbumButtonBox.php index 469fb34..ea631ea 100644 --- a/templates/AlbumButtonBox.php +++ b/templates/AlbumButtonBox.php @@ -28,26 +28,31 @@ class AlbumButtonBox extends Template echo ' ', $button['caption'], ''; - echo ' + if (!empty($this->filters)) + { + echo ' '; } echo ' - - '; } }