From 87dd176429f4c15d6faa91cb1b97954634482861 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georg=20Mai=C3=9Fer?= Date: Mon, 30 Dec 2024 13:44:56 +0100 Subject: [PATCH] Improvement: Better sorting test if it's an associative array --- classes/output/table.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/classes/output/table.php b/classes/output/table.php index b45e87f..de69d99 100644 --- a/classes/output/table.php +++ b/classes/output/table.php @@ -760,16 +760,18 @@ public function return_sort_columns(array $sortcolumns) { global $SESSION; - if (empty($this->wbtable->sortablecolumns )) { + if (empty($this->wbtable->sortablecolumns)) { return null; } + $isassociative = array_keys($this->wbtable->sortablecolumns) !== range(0, count($this->wbtable->sortablecolumns) - 1); + $sortarray['options'] = []; foreach ($this->wbtable->sortablecolumns as $key => $value) { // If we have an assoziative array, we have localized values. // Else, we need to use the same value twice. - if (!isset($this->wbtable->columns[$key])) { + if (!$isassociative) { $key = $value; }