Allow users to filter albums by contributors #48
@ -47,7 +47,10 @@ class ViewPhotoAlbum extends HTMLController
|
|||||||
$contributors = $tag->getContributorList();
|
$contributors = $tag->getContributorList();
|
||||||
|
|
||||||
// Enumerate possible filters
|
// 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()];
|
||||||
Aaron marked this conversation as resolved
Outdated
|
|||||||
foreach ($contributors as $contributor)
|
foreach ($contributors as $contributor)
|
||||||
{
|
{
|
||||||
$filters[$contributor['slug']] = [
|
$filters[$contributor['slug']] = [
|
||||||
@ -57,6 +60,7 @@ class ViewPhotoAlbum extends HTMLController
|
|||||||
'link' => $tag->getUrl() . '/?by=' . $contributor['slug'],
|
'link' => $tag->getUrl() . '/?by=' . $contributor['slug'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Limit to a particular uploader?
|
// Limit to a particular uploader?
|
||||||
$active_filter = '';
|
$active_filter = '';
|
||||||
|
@ -28,6 +28,8 @@ class AlbumButtonBox extends Template
|
|||||||
echo '
|
echo '
|
||||||
<a class="btn btn-light" href="', $button['url'], '">', $button['caption'], '</a>';
|
<a class="btn btn-light" href="', $button['url'], '">', $button['caption'], '</a>';
|
||||||
|
|
||||||
|
if (!empty($this->filters))
|
||||||
|
{
|
||||||
echo '
|
echo '
|
||||||
<div class="dropdown">
|
<div class="dropdown">
|
||||||
<button class="btn btn-light dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
|
<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 '
|
echo '
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '
|
||||||
</div>';
|
</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user
Key
label
missingI initially didn't add it as it'd never be used. You're right, though, and it's better to just have it there for consistency.