function number_field_settings_form
number_field_settings_form($field, $instance, $has_data)
Implements hook_field_settings_form().
File
- modules/field/modules/number/number.module, line 55
- Defines numeric field types.
Code
function number_field_settings_form($field, $instance, $has_data) { $settings = $field['settings']; $form = array(); if ($field['type'] == 'number_decimal') { $form['precision'] = array( '#type' => 'select', '#title' => t('Precision'), '#options' => drupal_map_assoc(range(10, 32)), '#default_value' => $settings['precision'], '#description' => t('The total number of digits to store in the database, including those to the right of the decimal.'), '#disabled' => $has_data, ); $form['scale'] = array( '#type' => 'select', '#title' => t('Scale'), '#options' => drupal_map_assoc(range(0, 10)), '#default_value' => $settings['scale'], '#description' => t('The number of digits to the right of the decimal.'), '#disabled' => $has_data, ); } if ($field['type'] == 'number_decimal' || $field['type'] == 'number_float') { $form['decimal_separator'] = array( '#type' => 'select', '#title' => t('Decimal marker'), '#options' => array('.' => t('Decimal point'), ',' => t('Comma')), '#default_value' => $settings['decimal_separator'], '#description' => t('The character users will input to mark the decimal point in forms.'), ); } return $form; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!field!modules!number!number.module/function/number_field_settings_form/7.x