You are here

function better_statistics_handler_field_time_interval_opt::options_form in Better Statistics 7

Overrides views_handler_field_numeric::options_form().

Overrides views_handler_field_numeric::options_form

File

views/better_statistics_handler_field_time_interval_opt.inc, line 29
Definition of better_statistics_handler_field_time_interval_opt.

Class

better_statistics_handler_field_time_interval_opt
A field handler to provide the option for numeric fields to be displayed as proper time intervals.

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);

  // Checkbox to optionally render as a time interval.
  $form['as_interval'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display as time interval'),
    '#default_value' => $this->options['as_interval'],
  );

  // Dependent textfield to determine time interval granularity.
  $form['granularity'] = array(
    '#type' => 'textfield',
    '#title' => t('Granularity'),
    '#description' => t('How many different units to display in the string.'),
    '#default_value' => $this->options['granularity'],
    '#dependency' => array(
      'edit-options-as-interval' => array(
        TRUE,
      ),
    ),
  );
}