You are here

function theme_password in Drupal 4

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

Format a password field.

Parameters

$element: An associative array containing the properties of the element. Properties used: title, value, description, size, maxlength, required, attributes

Return value

A themed HTML string representing the form.

Related topics

File

includes/form.inc, line 1107

Code

function theme_password($element) {
  $size = $element['#size'] ? ' size="' . $element['#size'] . '" ' : '';
  $maxlength = $element['#maxlength'] ? ' maxlength="' . $element['#maxlength'] . '" ' : '';
  _form_set_class($element, array(
    'form-text',
  ));
  $output = '<input type="password" name="' . $element['#name'] . '" id="' . $element['#id'] . '" ' . $maxlength . $size . drupal_attributes($element['#attributes']) . ' />';
  return theme('form_element', $element['#title'], $output, $element['#description'], $element['#id'], $element['#required'], form_get_error($element));
}