form_weight

Versions
4.6
form_weight($title = NULL, $name = 'weight', $value = 0, $delta = 10, $description = NULL, $extra = 0)

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.

Related topics

▾ 11 functions call form_weight()

block_admin_display in modules/block.module
Prepare the main block administration form.
book_admin_view_line in modules/book.module
book_form in modules/book.module
Implementation of hook_form().
book_outline in modules/book.module
Implementation of function book_outline() Handles all book outline operations.
filter_admin_order in modules/filter.module
Menu callback; display form for ordering filters for a format.
forum_form_container in modules/forum.module
Returns a form for adding a container to the forum vocabulary
forum_form_forum in modules/forum.module
Returns a form for adding a forum to the forum vocabulary
menu_edit_item_form in modules/menu.module
Present the menu item editing form.
taxonomy_form_term in modules/taxonomy.module
taxonomy_form_vocabulary in modules/taxonomy.module
_profile_field_form in modules/profile.module

Code

includes/common.inc, line 1432

<?php
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);
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.