From b48c8ea820c41770c8e8dd2417aada6094bd37e9 Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Wed, 24 Sep 2025 12:32:29 +0200 Subject: [PATCH] EditAlbum: reorder asset loading --- controllers/EditAlbum.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/controllers/EditAlbum.php b/controllers/EditAlbum.php index 280803c..99cd3f9 100644 --- a/controllers/EditAlbum.php +++ b/controllers/EditAlbum.php @@ -6,6 +6,7 @@ * Kabuki CMS (C) 2013-2017, Aaron van Geffen *****************************************************************************/ +// TODO: extend EditTag? class EditAlbum extends HTMLController { 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([ 'request_url' => BASEURL . '/editalbum/?' . ($id_tag ? 'id=' . $id_tag : 'add'), 'buttons_extra' => $after_form, @@ -150,9 +141,18 @@ class EditAlbum extends HTMLController $this->formview = new FormView($this->form, $form_title ?? ''); $this->page->adopt($this->formview); - // If we have asset images, show the thumbnail manager - if (!empty($id_tag) && $num_assets > 0) - $this->page->adopt(new FeaturedThumbnailManager($assets, $id_tag ? $album->id_asset_thumb : 0)); + 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 ($num_assets > 0) + $this->page->adopt(new FeaturedThumbnailManager($assets, $id_tag ? $album->id_asset_thumb : 0)); + } if (isset($_POST['changeThumbnail'])) $this->processThumbnail($album);