diff options
Diffstat (limited to 'includes/tablesort.inc')
-rw-r--r-- | includes/tablesort.inc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/includes/tablesort.inc b/includes/tablesort.inc index 3c2068e1b..36f01607f 100644 --- a/includes/tablesort.inc +++ b/includes/tablesort.inc @@ -165,13 +165,14 @@ function tablesort_get_order($headers) { return $default; } else { - // The first column specified is initial 'order by' field unless otherwise specified - if (is_array($headers[0])) { - $headers[0] += array('data' => NULL, 'field' => NULL); - return array('name' => $headers[0]['data'], 'sql' => $headers[0]['field']); + // The first column specified is the initial 'order by' field unless otherwise specified. + $first = current($headers); + if (is_array($first)) { + $first += array('data' => NULL, 'field' => NULL); + return array('name' => $first['data'], 'sql' => $first['field']); } else { - return array('name' => $headers[0]); + return array('name' => $first, 'sql' => ''); } } } |