You are here

public function views_field_tooltip_plugin_display_extender::options_form in Views Field Tooltip 7

Provide a form to edit options for this plugin.

Overrides views_plugin_display_extender::options_form

File

views/views_field_tooltip_plugin_display_extender.inc, line 57

Class

views_field_tooltip_plugin_display_extender
A display extender Views plugin for views_field_toolip.

Code

public function options_form(&$form, &$form_state) {
  if ($form_state['section'] != 'qtip') {
    return;
  }
  $library = variable_get('views_field_tooltip_library', 'qtip2');
  $info = views_field_tooltip_get_library_info($library);
  if (!empty($info)) {
    $form['label'] = array(
      '#type' => 'textarea',
      '#title' => t('Label #1 default settings'),
      '#description' => t('These settings apply to all label #1 tooltips and can be overridden in the field settings UI.'),
      '#default_value' => jsonpp($this->display
        ->get_option('label')),
    );
    $form['label2'] = array(
      '#type' => 'textarea',
      '#title' => t('Label #2 default settings'),
      '#description' => t('These settings apply to all label #2 tooltips and can be overridden in the field settings UI.'),
      '#default_value' => jsonpp($this->display
        ->get_option('label2')),
    );
    $qtip_field = $this->display
      ->get_option('field');
    if (empty($qtip_field)) {
      $qtip_field = $this->display
        ->get_option('qtip');
    }
    $form['field'] = array(
      '#type' => 'textarea',
      '#title' => t('Field default settings'),
      '#description' => t('These settings apply to all field tooltips and can be overridden in the field settings UI.') . ' ' . call_user_func($info['help callback']),
      '#default_value' => jsonpp($qtip_field),
    );
  }
  else {
    foreach (array(
      'label',
      'label2',
      'field',
    ) as $qtip) {
      $form[$qtip] = array(
        '#type' => 'value',
        '#value' => jsonpp($this->display
          ->get_option($qtip)),
      );
    }
    drupal_set_message(t('Tooltip library variable <code>views_field_tooltip_library</code> holds unknown value %library. Supported libraries are <em>qtip</em> and <em>qtip2</em>.', array(
      '%library' => $library,
    )), 'warning');
  }
  $form['#title'] = t('Tooltip style');
}