theme_select
Definition
theme_select($element)
includes/form.inc, line 654
Description
Format a dropdown menu or scrolling selection box.
It is possible to group options together; to do this, change the format of $options to an associative array in which the keys are group labels, and the values are associative arrays in the normal $options format.
Parameters
$element An associative array containing the properties of the element. Properties used: title, value, options, description, extra, multiple, required
Return value
A themed HTML string representing the form element.
Related topics
| Name | Description |
|---|---|
| Form generation | Functions to enable output of HTML forms and form elements. |
Code
<?php
function theme_select($element) {
$select = '';
$size = $element['#size'] ? ' size="' . $element['#size'] . '"' : '';
_form_set_class($element, array('form-select'));
return theme('form_element', $element['#title'], '<select name="'. $element['#name'] .''. ($element['#multiple'] ? '[]' : '') .'"'. ($element['#multiple'] ? ' multiple="multiple" ' : '') . drupal_attributes($element['#attributes']) .' id="' . $element['#id'] .'" '. $size .'>'. form_select_options($element) .'</select>', $element['#description'], $element['#id'], $element['#required'], form_get_error($element));
}
?> 