theme_select

5 form.inc theme_select($element)
6 form.inc theme_select($element)
7 form.inc theme_select($variables)
8 form.inc theme_select($variables)

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 string reference to 'theme_select'

1 theme call to theme_select()

File

includes/form.inc, line 1423

Code

function theme_select($element) {
  $select = '';
  $size = $element['#size'] ? ' size="' . $element['#size'] . '"' : '';
  _form_set_class($element, array('form-select'));
  $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>');
}

Comments

Reverse order

How to reverse order of elements in list? I'm using this function in template.php to override order of taxonomy terms in select list. I would like to list terms alphabetically descending but don't have a clue how to do it.

Got it

If someone needs same thing I have posted solution here:
http://api.drupal.org/api/drupal/modules--taxonomy--taxonomy.module/func...

Login or register to post comments