Commit 5011c109 authored by ckng's avatar ckng Committed by Neslee
Browse files

Issue #2281281 by mikeker, m.lebedev, LGLC, ckng, smitty: Allow reordering of...

Issue #2281281 by mikeker, m.lebedev, LGLC, ckng, smitty: Allow reordering of options during rewriting
parent 3e506311
......@@ -944,9 +944,11 @@ dateFormat: "dd-mm-yy"
$rewrite[$search] = $replace;
}
}
foreach ($options as $index => $option) {
if (isset($rewrite[$option])) {
if ('' == $rewrite[$option]) {
// Create new options array, based on order set in the rewrite settings.
$rewritten_options = array();
foreach ($rewrite as $search => $replace) {
if ($index = array_search($search, $options)) {
if ('' == $replace) {
unset($options[$index]);
if ($selected == $index) {
// Avoid "Illegal choice" errors.
......@@ -954,10 +956,12 @@ dateFormat: "dd-mm-yy"
}
}
else {
$options[$index] = $rewrite[$option];
$rewritten_options[$index] = $replace;
}
}
}
// Append any remaining non-rewritten options.
$options = $rewritten_options + $options;
}
$form[$settings['sort']['advanced']['combine_param']] = array(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment