| 69 | | $option_options = array('value' => $key); |
|---|
| 70 | | if ( |
|---|
| 71 | | isset($selected) |
|---|
| 72 | | && |
|---|
| 73 | | (is_array($selected) && in_array(strval($key), $valid, true)) |
|---|
| 74 | | || |
|---|
| 75 | | (strval($key) == strval($selected)) |
|---|
| 76 | | ) |
|---|
| 77 | | { |
|---|
| 78 | | $option_options['selected'] = 'selected'; |
|---|
| 79 | | } |
|---|
| 80 | | |
|---|
| 81 | | $html .= content_tag('option', $value, $option_options)."\n"; |
|---|
| | 69 | if (is_array($value)) |
|---|
| | 70 | { |
|---|
| | 71 | $optgroup_html_options = $html_options; |
|---|
| | 72 | unset($optgroup_html_options['include_custom']); |
|---|
| | 73 | unset($optgroup_html_options['include_blank']); |
|---|
| | 74 | $html .= content_tag('optgroup', options_for_select($value, $selected, $optgroup_html_options), array('label' => $key)); |
|---|
| | 75 | } |
|---|
| | 76 | else |
|---|
| | 77 | { |
|---|
| | 78 | $option_options = array('value' => $key); |
|---|
| | 79 | |
|---|
| | 80 | if ( |
|---|
| | 81 | isset($selected) |
|---|
| | 82 | && |
|---|
| | 83 | (is_array($selected) && in_array(strval($key), $valid, true)) |
|---|
| | 84 | || |
|---|
| | 85 | (strval($key) == strval($selected)) |
|---|
| | 86 | ) |
|---|
| | 87 | { |
|---|
| | 88 | $option_options['selected'] = 'selected'; |
|---|
| | 89 | } |
|---|
| | 90 | |
|---|
| | 91 | $html .= content_tag('option', $value, $option_options)."\n"; |
|---|
| | 92 | } |
|---|