You are here

function TimefieldPluginStyleMinical::options_form in Timefield 7

Options form

Overrides views_plugin_style::options_form

File

views/timefield_plugin_style_minical.inc, line 27
This file holds style plugin Timefield MiniCal

Class

TimefieldPluginStyleMinical
@class Extension of the Views Plugin Syle for

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  $handlers = $this->display->handler
    ->get_handlers('field');
  $data_source_options = $box_source_options = array(
    '' => '<none>',
  );
  foreach ($handlers as $handle) {
    $box_source_options[$handle->options['id']] = !empty($handle->options['label']) ? $handle->options['label'] : $handle->options['id'];
    if (!empty($handle->field_info['type']) && $handle->field_info['type'] == 'timefield') {
      $data_source_options[$handle->options['id']] = $handle->options['label'];
    }
  }
  if (count($data_source_options) == 1) {
    $form['error'] = array(
      '#markup' => 'Please add at least 1 weekly summary field to the view',
    );
  }
  else {
    $form['data_source'] = array(
      '#type' => 'select',
      '#title' => t('Data Source'),
      '#description' => t('What field provides the weekly summary (timefield) data?'),
      '#options' => $data_source_options,
      '#default_value' => $this->options['data_source'] ? $this->options['data_source'] : '',
    );
    $form['box_source'] = array(
      '#type' => 'select',
      '#title' => t('Fill in Text'),
      '#description' => t('What field provides the content for the mini-calendar table cell?'),
      '#options' => $box_source_options,
      '#default_value' => $this->options['box_source'] ? $this->options['box_source'] : '',
    );
  }
}