You are here

function theme_select in Drupal 5

Same name and namespace in other branches
  1. 4 includes/form.inc \theme_select()
  2. 6 includes/form.inc \theme_select()
  3. 7 includes/form.inc \theme_select()

Format a dropdown menu or scrolling selection box.

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.

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.

Related topics

1 theme call to theme_select()
theme_taxonomy_term_select in modules/taxonomy/taxonomy.module
We use the default selection field for choosing terms.

File

includes/form.inc, line 932

Code

function theme_select($element) {
  $select = '';
  $size = $element['#size'] ? ' size="' . $element['#size'] . '"' : '';
  _form_set_class($element, array(
    'form-select',
  ));
  $multiple = isset($element['#multiple']) && $element['#multiple'];
  return theme('form_element', $element, '<select name="' . $element['#name'] . '' . ($multiple ? '[]' : '') . '"' . ($multiple ? ' multiple="multiple" ' : '') . drupal_attributes($element['#attributes']) . ' id="' . $element['#id'] . '" ' . $size . '>' . form_select_options($element) . '</select>');
}