Definition

form_weight($title = NULL, $name = 'weight', $value = 0, $delta = 10, $description = NULL, $extra = 0)
drupal-4-6/includes/common.inc, line 1432

Description

Format a weight selection menu.

Parameters

$title The label for the form element.

$name The internal name used to refer to the form element.

$value The selected weight value at page load time.

$delta The largest in absolute value the weight can be. For example, if set to 10, weights could range from -10 to 10 inclusive.

$description Explanatory text to display after the form item.

$extra Additional HTML to inject into the select element tag.

Return value

A themed HTML string representing the form element.

Code

function form_weight($title = NULL, $name = 'weight', $value = 0, $delta = 10, $description = NULL, $extra = 0) {
  for ($n = (-1 * $delta); $n <= $delta; $n++) {
    $weights[$n] = $n;
  }

  return form_select($title, $name, $value, $weights, $description, $extra);
}