You are here

public function role_expire_handler_field_expiry_timestamp::options_form in Role Expire 7

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

Overrides views_handler_field_prerender_list::options_form

File

./role_expire.views.inc, line 282
Role Expire Views hooks

Class

role_expire_handler_field_expiry_timestamp
Class role_expire_handler_field_expiry_timestamp.

Code

public function options_form(&$form, &$form_state) {
  $date_formats = array();
  $date_types = system_get_date_types();
  foreach ($date_types as $key => $value) {
    $date_formats[$value['type']] = t('@date_format format', array(
      '@date_format' => $value['title'],
    )) . ': ' . format_date(REQUEST_TIME, $value['type']);
  }
  $form['date_format'] = array(
    '#type' => 'select',
    '#title' => t('Date format'),
    '#options' => $date_formats + array(
      'custom' => t('Custom'),
    ),
    '#default_value' => isset($this->options['date_format']) ? $this->options['date_format'] : 'small',
  );
  $form['custom_date_format'] = array(
    '#type' => 'textfield',
    '#title' => t('Custom date format'),
    '#description' => t('If "Custom", see the <a href="@url" target="_blank">PHP manual</a> for date formats. Otherwise, enter the number of different time units to display, which defaults to 2.', array(
      '@url' => 'http://php.net/manual/function.date.php',
    )),
    '#default_value' => isset($this->options['custom_date_format']) ? $this->options['custom_date_format'] : '',
    '#dependency' => array(
      'edit-options-date-format' => $this
        ->supported_date_types(),
    ),
  );
  $form['timezone'] = array(
    '#type' => 'select',
    '#title' => t('Timezone'),
    '#description' => t('Timezone to be used for date output.'),
    '#options' => array(
      '' => t('- Default site/user timezone -'),
    ) + system_time_zones(FALSE),
    '#default_value' => $this->options['timezone'],
    '#dependency' => array(
      'edit-options-date-format' => array_merge(array(
        'custom',
      ), array_keys($date_formats)),
    ),
  );
  parent::options_form($form, $form_state);
}