From 8367d662fcaad1c09e48ae36bc4249b60570aefb Mon Sep 17 00:00:00 2001
From: Kjartan Mannes <kjartan@2.no-reply.drupal.org>
Date: Mon, 18 Jun 2001 20:51:58 +0000
Subject: [PATCH] Changes - Modifed form_select() to accept an optional 6th
 parameter which is appeneded   to the select tag. $value can now also be an
 array. This allows for multiple   selects:   form_select($header, $name,
 $values, $options, $help, "multiple=\"true\" size=\"10\""); - Updated
 account.module to use the extended form_select() functionality.

---
 includes/common.inc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/includes/common.inc b/includes/common.inc
index ac78a5d4ccd9..e52760ec06b0 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -179,10 +179,10 @@ function form_textarea($title, $name, $value, $cols, $rows, $description = 0) {
   return form_item($title, "<textarea wrap=\"virtual\" cols=\"$cols\" rows=\"$rows\" name=\"edit[$name]\">". check_form($value) ."</textarea>", $description);
 }
 
-function form_select($title, $name, $value, $options, $description = 0) {
+function form_select($title, $name, $value, $options, $description = 0, $extra = 0) {
   if (count($options) > 0) {
-    foreach ($options as $key=>$choice) $select .= "<option value=\"$key\"". ($key == $value ? " selected" : "") .">". check_form($choice) ."</option>";
-    return form_item($title, "<select name=\"edit[$name]\">$select</select>", $description);
+    foreach ($options as $key=>$choice) $select .= "<option value=\"$key\"". (is_array($value) ? (in_array($key, $value) ? " selected" : "") : ($key == $value ? " selected" : "")) .">". check_form($choice) ."</option>";
+    return form_item($title, "<select name=\"edit[$name]\"". ($extra ? " $extra" : "") .">$select</select>", $description);
   }
 }
 
-- 
GitLab