fix: Show proper upload media popup when using filter after upload

Add the needed parameters to the hidden form used in the media library form so that a reload of the ML after the first upload still crenders the correct ML variant - the one for selecting an image, not the generic
This commit is contained in:
onli 2021-05-13 21:26:58 +02:00
parent e448d1c384
commit 9b758e84db

View File

@ -3253,6 +3253,18 @@ function serendipity_showMedia(&$file, &$paths, $url = '', $manage = false, $lin
}
}
// Add variables to the hidden form, so they persist in the ML popup after an item as been uploaded and the
// form filter gets used
if ($serendipity['GET']['adminAction'] == 'add') {
$target_fields = ['textarea', 'htmltarget', 'filename_only', 'noBanner', 'noSidebar', 'noFooter', 'showMediaToolbar', 'multiselect', 'showUpload'];
foreach ($target_fields as $target_field) {
if (isset($serendipity['GET'][$target_field])) {
$form_hidden .= ' <input type="hidden" name="serendipity[' . $target_field . ']" value="' . serendipity_specialchars($serendipity['GET'][$target_field]) . '">'."\n";
}
}
$form_hidden .= ' <input type="hidden" name="serendipity[adminModule]" value="media">'."\n";
}
if (!is_object($serendipity['smarty'])) {
serendipity_smarty_init();
}