EditAlbum: address refactor mistake
This commit is contained in:
parent
041b56ff8c
commit
b775cffc0c
@ -67,7 +67,7 @@ class EditAlbum extends HTMLController
|
||||
|
||||
// Gather possible parents for this album to be filed into
|
||||
$parentChoices = [0 => '-root-'];
|
||||
foreach (PhotoAlbum::getHierarchy('tag', 'up') as $parent)
|
||||
foreach (Tag::getOffset(0, 9999, 'tag', 'up', true) as $parent)
|
||||
{
|
||||
if (!empty($id_tag) && $parent['id_tag'] == $id_tag)
|
||||
continue;
|
||||
@ -139,6 +139,10 @@ class EditAlbum extends HTMLController
|
||||
];
|
||||
}
|
||||
}
|
||||
elseif (empty($_POST) && isset($album))
|
||||
{
|
||||
$formDefaults = get_object_vars($album);
|
||||
}
|
||||
elseif (empty($_POST) && count($parentChoices) > 1)
|
||||
{
|
||||
// Choose the first non-root album as the default parent
|
||||
@ -146,9 +150,8 @@ class EditAlbum extends HTMLController
|
||||
next($parentChoices);
|
||||
$formDefaults = ['id_parent' => key($parentChoices)];
|
||||
}
|
||||
|
||||
if (!isset($formDefaults))
|
||||
$formDefaults = isset($album) ? get_object_vars($album) : $_POST;
|
||||
else
|
||||
$formDefaults = $_POST;
|
||||
|
||||
// Create the form, add in default values.
|
||||
$this->form->setData($formDefaults);
|
||||
|
@ -67,7 +67,7 @@ class EditAsset extends HTMLController
|
||||
|
||||
// Get a list of available photo albums
|
||||
$allAlbums = [];
|
||||
foreach (PhotoAlbum::getHierarchy('tag', 'up') as $album)
|
||||
foreach (Tag::getOffset(0, 9999, 'tag', 'up', true) as $album)
|
||||
$allAlbums[$album['id_tag']] = $album['tag'];
|
||||
|
||||
// Figure out the current album id
|
||||
|
Loading…
Reference in New Issue
Block a user