EditAlbum: reorder asset loading

This commit is contained in:
Aaron van Geffen 2025-09-24 12:32:29 +02:00
parent c9da46b36f
commit b48c8ea820

View File

@ -6,6 +6,7 @@
* Kabuki CMS (C) 2013-2017, Aaron van Geffen * Kabuki CMS (C) 2013-2017, Aaron van Geffen
*****************************************************************************/ *****************************************************************************/
// TODO: extend EditTag?
class EditAlbum extends HTMLController class EditAlbum extends HTMLController
{ {
private $form; private $form;
@ -102,16 +103,6 @@ class EditAlbum extends HTMLController
], ],
]; ];
// Fetch image assets for this album
if (!empty($id_tag))
{
list($assets, $num_assets) = AssetIterator::getByOptions([
'direction' => 'desc',
'limit' => 500,
'id_tag' => $id_tag,
], true);
}
$this->form = new Form([ $this->form = new Form([
'request_url' => BASEURL . '/editalbum/?' . ($id_tag ? 'id=' . $id_tag : 'add'), 'request_url' => BASEURL . '/editalbum/?' . ($id_tag ? 'id=' . $id_tag : 'add'),
'buttons_extra' => $after_form, 'buttons_extra' => $after_form,
@ -150,9 +141,18 @@ class EditAlbum extends HTMLController
$this->formview = new FormView($this->form, $form_title ?? ''); $this->formview = new FormView($this->form, $form_title ?? '');
$this->page->adopt($this->formview); $this->page->adopt($this->formview);
if (!empty($id_tag))
{
list($assets, $num_assets) = AssetIterator::getByOptions([
'direction' => 'desc',
'limit' => 500,
'id_tag' => $id_tag,
], true);
// If we have asset images, show the thumbnail manager // If we have asset images, show the thumbnail manager
if (!empty($id_tag) && $num_assets > 0) if ($num_assets > 0)
$this->page->adopt(new FeaturedThumbnailManager($assets, $id_tag ? $album->id_asset_thumb : 0)); $this->page->adopt(new FeaturedThumbnailManager($assets, $id_tag ? $album->id_asset_thumb : 0));
}
if (isset($_POST['changeThumbnail'])) if (isset($_POST['changeThumbnail']))
$this->processThumbnail($album); $this->processThumbnail($album);