You are here

function fraction_handler_field::options_form in Fraction 7

@inheritdoc

Overrides views_handler_field::options_form

File

views/handlers/fraction_handler_field.inc, line 29
Contains the Fraction Views field handler.

Class

fraction_handler_field
Field handler for Fraction database columns.

Code

function options_form(&$form, &$form_state) {

  // Add fields for configuring precision and auto_precision.
  $form['precision'] = array(
    '#type' => 'textfield',
    '#title' => t('Precision'),
    '#description' => t('Specify the number of digits after the decimal place to display when converting the fraction to a decimal. When "Auto precision" is enabled, this value essentially becomes a minimum fallback precision.'),
    '#default_value' => $this->options['precision'],
  );
  $form['auto_precision'] = array(
    '#type' => 'checkbox',
    '#title' => t('Auto precision'),
    '#description' => t('Automatically determine the maximum precision if the fraction has a base-10 denominator. For example, 1/100 would have a precision of 2, 1/1000 would have a precision of 3, etc.'),
    '#default_value' => $this->options['auto_precision'],
  );

  // Merge into the parent form.
  parent::options_form($form, $form_state);

  // Remove the 'click_sort_column' form element, because we provide a custom
  // click_sort function below to use the numerator and denominator columns
  // simultaneously.
  unset($form['click_sort_column']);
}