You are here

function brightcove_cck_handler_field_video_date::options_form in Brightcove Video Connect 6

Same name and namespace in other branches
  1. 6.2 brightcove_cck/views/brightcove_cck_handler_field_video_date.inc \brightcove_cck_handler_field_video_date::options_form()

Provide formatter option.

Overrides content_handler_field_multiple::options_form

1 call to brightcove_cck_handler_field_video_date::options_form()
brightcove_cck_handler_field_video_date_multiple::options_form in brightcove_cck/views/brightcove_cck_handler_field_video_date_multiple.inc
Provide 'group multiple values' option.
1 method overrides brightcove_cck_handler_field_video_date::options_form()
brightcove_cck_handler_field_video_date_multiple::options_form in brightcove_cck/views/brightcove_cck_handler_field_video_date_multiple.inc
Provide 'group multiple values' option.

File

brightcove_cck/views/brightcove_cck_handler_field_video_date.inc, line 57
The subclass adds basic field and formatter info, for field-specific subclasses to use if they need to.

Class

brightcove_cck_handler_field_video_date
@file The subclass adds basic field and formatter info, for field-specific subclasses to use if they need to.

Code

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

  // TODO: do we want the 'link to node' checkbox ?
  // That's usually formatters business...
  $field = $this->content_field;
  $options = $this->options;
  unset($form['format']);
  unset($form['label_type']);
  $form['label'] = array(
    '#type' => 'textfield',
    '#title' => t('Label'),
    '#default_value' => isset($this->options['label']) ? $this->options['label'] : '',
    '#description' => t('The label for this field that will be displayed to end users if the style requires it.'),
  );
  $time = time();
  $form['date_format'] = array(
    '#type' => 'select',
    '#title' => t('Date format'),
    '#options' => array(
      'small' => format_date($time, 'small'),
      'medium' => format_date($time, 'medium'),
      'large' => format_date($time, 'large'),
      'custom' => t('Custom'),
      'raw time ago' => t('Time ago'),
      'time ago' => t('Time ago (with "ago" appended)'),
      'raw time span' => t('Time span (future dates start with - )'),
      'time span' => t('Time span (with "ago/hence" appended)'),
    ),
    '#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 <a href="http://us.php.net/manual/en/function.date.php" target="_blank">the PHP docs</a> for date formats. If "Time ago" this is the the number of different units to display, which defaults to two.'),
    '#default_value' => isset($this->options['custom_date_format']) ? $this->options['custom_date_format'] : '',
    '#process' => array(
      'views_process_dependency',
    ),
    '#dependency' => array(
      'edit-options-date-format' => array(
        'custom',
        'raw time ago',
        'time ago',
        'raw time span',
        'time span',
      ),
    ),
  );
}