From 3ccd437530bac14be8bdc3e3a503930d77aedd96 Mon Sep 17 00:00:00 2001
From: Dries Buytaert <dries@buytaert.net>
Date: Sat, 18 Jul 2009 02:41:05 +0000
Subject: [PATCH] - Patch #517318 by dmitrig01: tableselect needs to be able to
 give options weights.

---
 includes/form.inc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/includes/form.inc b/includes/form.inc
index 5cfbcfad2573..e4831d88ec68 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -2225,6 +2225,8 @@ function form_process_tableselect($element) {
       $element['#default_value'] = array();
     }
 
+    // Sort the options by their #weight if they have a #weight.
+    uasort($element['#options'], 'element_sort');
     // Create a checkbox or radio for each item in #options in such a way that
     // the value of the tableselect element behaves as if it had been of type
     // checkboxes or radios.
-- 
GitLab