From 5b570b66873ff132e9d57148704104fb75ee181c Mon Sep 17 00:00:00 2001
From: M Parker <mparker17@536298.no-reply.drupal.org>
Date: Fri, 18 Jul 2014 09:45:11 -0400
Subject: [PATCH] 2283675-5

---
 core/includes/form.inc | 34 +++++++++++++++++++++++++---------
 1 file changed, 25 insertions(+), 9 deletions(-)

diff --git a/core/includes/form.inc b/core/includes/form.inc
index 3ceb5e3..5a0afef 100644
--- a/core/includes/form.inc
+++ b/core/includes/form.inc
@@ -861,17 +861,33 @@ function template_preprocess_select(&$variables) {
 }
 
 /**
- * Converts a select form element's options array into HTML.
+ * Converts an array of options into HTML, for use in select list form elements.
  *
- * @param $element
- *   An associative array containing the properties of the element.
- * @param $choices
- *   Mixed: Either an associative array of items to list as choices, or an
- *   object with an 'option' member that is an associative array. This
- *   parameter is only used internally and should not be passed.
+ * This function calls itself recursively to obtain the values for a optgroup.
  *
- * @return
- *   An HTML string of options for the select form element.
+ * @param array $element
+ *   An associative array containing the following key-value pairs:
+ *   - '#multiple': Optional boolean indicating if the user may select more than
+ *     one item.
+ *   - '#options': An array of options to render as HTML.
+ *     A string or integer key mapped to a translated string is interpreted as a
+ *     single HTML option element. Note that the key will be visible in the
+ *     HTML and could be modified by malicious users, so don't put sensitive
+ *     information in it and sanitize it before use.
+ *     A translated string mapped to an array indicates a group of options. The
+ *     array should contain the options you wish to group. Groups are output as
+ *     HTML optgroup elements.
+ *   - '#value': Optional integer, string or array representing which option(s)
+ *     to pre-select when the list is first displayed. The integer or string
+ *     must match the key of an option in the '#options' list. If '#multiple' is
+ *     TRUE, this can be an array of integers or strings.
+ * @param array|object|null $choices
+ *   Either an associative array of options, an object with an 'option' member
+ *   that is an associative array, or NULL. This parameter is only used
+ *   internally and should not be passed.
+ *
+ * @return string
+ *   An HTML string of options and optgroups for use in a select form element.
  */
 function form_select_options($element, $choices = NULL) {
   if (!isset($choices)) {
-- 
2.0.0

