You are here

function views_handler_field_numeric::options_form in Views (for Drupal 7) 6.2

Same name and namespace in other branches
  1. 6.3 handlers/views_handler_field_numeric.inc \views_handler_field_numeric::options_form()
  2. 7.3 handlers/views_handler_field_numeric.inc \views_handler_field_numeric::options_form()

Default options form that provides the label widget that all fields should have.

Overrides views_handler_field::options_form

3 calls to views_handler_field_numeric::options_form()
views_handler_field_math::options_form in handlers/views_handler_field_math.inc
Default options form that provides the label widget that all fields should have.
views_handler_field_node_new_comments::options_form in modules/comment/views_handler_field_node_new_comments.inc
Default options form that provides the label widget that all fields should have.
views_handler_field_search_score::options_form in modules/search/views_handler_field_search_score.inc
Default options form that provides the label widget that all fields should have.
3 methods override views_handler_field_numeric::options_form()
views_handler_field_math::options_form in handlers/views_handler_field_math.inc
Default options form that provides the label widget that all fields should have.
views_handler_field_node_new_comments::options_form in modules/comment/views_handler_field_node_new_comments.inc
Default options form that provides the label widget that all fields should have.
views_handler_field_search_score::options_form in modules/search/views_handler_field_search_score.inc
Default options form that provides the label widget that all fields should have.

File

handlers/views_handler_field_numeric.inc, line 28

Class

views_handler_field_numeric
Render a field as a numeric value

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  if (!empty($this->definition['float'])) {
    $form['set_precision'] = array(
      '#type' => 'checkbox',
      '#title' => t('Round'),
      '#description' => t('If checked, the number will be rounded.'),
      '#default_value' => $this->options['set_precision'],
    );
    $form['precision'] = array(
      '#type' => 'textfield',
      '#title' => t('Precision'),
      '#default_value' => $this->options['precision'],
      '#description' => t('Specify how many digits to print after the decimal point.'),
      '#process' => array(
        'views_process_dependency',
      ),
      '#dependency' => array(
        'edit-options-set-precision' => array(
          TRUE,
        ),
      ),
      '#size' => 2,
    );
    $form['decimal'] = array(
      '#type' => 'textfield',
      '#title' => t('Decimal point'),
      '#default_value' => $this->options['decimal'],
      '#description' => t('What single character to use as a decimal point.'),
      '#size' => 2,
    );
  }
  $form['separator'] = array(
    '#type' => 'textfield',
    '#title' => t('Thousands separator'),
    '#default_value' => $this->options['separator'],
    '#description' => t('What single character to use as the thousands separator.'),
    '#size' => 2,
  );
  $form['format_plural'] = array(
    '#type' => 'checkbox',
    '#title' => t('Format plural'),
    '#description' => t('If checked, special handling will be used for plurality.'),
    '#default_value' => $this->options['format_plural'],
  );
  $form['format_plural_singular'] = array(
    '#type' => 'textfield',
    '#title' => t('Singular form'),
    '#default_value' => $this->options['format_plural_singular'],
    '#description' => t('Text to use for the singular form.'),
    '#process' => array(
      'views_process_dependency',
    ),
    '#dependency' => array(
      'edit-options-format-plural' => array(
        TRUE,
      ),
    ),
  );
  $form['format_plural_plural'] = array(
    '#type' => 'textfield',
    '#title' => t('Plural form'),
    '#default_value' => $this->options['format_plural_plural'],
    '#description' => t('Text to use for the plural form, @count will be replaced with the value.'),
    '#process' => array(
      'views_process_dependency',
    ),
    '#dependency' => array(
      'edit-options-format-plural' => array(
        TRUE,
      ),
    ),
  );
  $form['prefix'] = array(
    '#type' => 'textfield',
    '#title' => t('Prefix'),
    '#default_value' => $this->options['prefix'],
    '#description' => t('Text to put before the number, such as currency symbol.'),
  );
  $form['suffix'] = array(
    '#type' => 'textfield',
    '#title' => t('Suffix'),
    '#default_value' => $this->options['suffix'],
    '#description' => t('Text to put after the number, such as currency symbol.'),
  );
}