You are here

function theme_numericfield in Format Number API 6

Same name and namespace in other branches
  1. 7 format_number.module \theme_numericfield()

Render a numeric form element.

Parameters

$element: An associative array containing the properties of the element.

Return value

A themed HTML string representing the input element.

File

./format_number.module, line 555
This module provides a method to configure number formats (site default and user defined) with configurable decimal point and thousand separators. It also exposes several functions that can be used by other contributed or custom modules to display…

Code

function theme_numericfield($element) {
  format_number_add_js();
  $size = empty($element['#size']) ? '' : ' size="' . $element['#size'] . '"';
  $maxlength = empty($element['#maxlength']) ? '' : ' maxlength="' . $element['#maxlength'] . '"';
  $output = '';
  _form_set_class($element, array(
    'form-numeric',
  ));
  if (isset($element['#field_prefix'])) {
    $output .= '<span class="field-prefix">' . $element['#field_prefix'] . '</span> ';
  }
  $output .= '<input type="text"' . $maxlength . ' name="' . $element['#name'] . '" id="' . $element['#id'] . '"' . $size . ' value="' . check_plain($element['#value']) . '"' . drupal_attributes($element['#attributes']) . ' />';
  if (isset($element['#field_suffix'])) {
    $output .= ' <span class="field-suffix">' . $element['#field_suffix'] . '</span>';
  }
  return theme('form_element', $element, $output);
}