You are here

public function entity_views_handler_field_duration::options_form in Entity API 7

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

Overrides views_handler_field::options_form

File

views/handlers/entity_views_handler_field_duration.inc, line 77
Contains the entity_views_handler_field_duration class.

Class

entity_views_handler_field_duration
A handler to provide proper displays for duration properties retrieved via data selection.

Code

public function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  EntityFieldHandlerHelper::options_form($this, $form, $form_state);
  $form['format_interval'] = array(
    '#type' => 'checkbox',
    '#title' => t('Format interval'),
    '#description' => t('If checked, the value will be formatted as a time interval. Otherwise, just the number of seconds will be displayed.'),
    '#default_value' => $this->options['format_interval'],
  );
  $form['granularity'] = array(
    '#type' => 'textfield',
    '#title' => t('Granularity'),
    '#default_value' => $this->options['granularity'],
    '#description' => t('Specify how many different units to display.'),
    '#dependency' => array(
      'edit-options-format-interval' => array(
        TRUE,
      ),
    ),
    '#size' => 2,
  );
  $form['prefix'] = array(
    '#type' => 'textfield',
    '#title' => t('Prefix'),
    '#default_value' => $this->options['prefix'],
    '#description' => t('Text to put before the duration text.'),
  );
  $form['suffix'] = array(
    '#type' => 'textfield',
    '#title' => t('Suffix'),
    '#default_value' => $this->options['suffix'],
    '#description' => t('Text to put after the duration text.'),
  );
}