EditAlbum: choose the first non-root album as the default parent

This commit is contained in:
Aaron van Geffen 2024-05-08 13:21:13 +02:00
parent 45b59636f6
commit 89cc00ffd9

View File

@ -139,6 +139,13 @@ class EditAlbum extends HTMLController
];
}
}
elseif (empty($_POST) && count($parentChoices) > 1)
{
// Choose the first non-root album as the default parent
reset($parentChoices);
next($parentChoices);
$formDefaults = ['id_parent' => key($parentChoices)];
}
if (!isset($formDefaults))
$formDefaults = isset($album) ? get_object_vars($album) : $_POST;