You are here

function views_data_export_plugin_style_export_csv::options_form in Views data export 6.3

Same name and namespace in other branches
  1. 6 plugins/views_data_export_plugin_style_export_csv.inc \views_data_export_plugin_style_export_csv::options_form()
  2. 6.2 plugins/views_data_export_plugin_style_export_csv.inc \views_data_export_plugin_style_export_csv::options_form()
  3. 7 plugins/views_data_export_plugin_style_export_csv.inc \views_data_export_plugin_style_export_csv::options_form()
  4. 7.3 plugins/views_data_export_plugin_style_export_csv.inc \views_data_export_plugin_style_export_csv::options_form()

Options form mini callback.

Parameters

$form: Form array to add additional fields to.

$form_state: State of the form.

Return value

None.

Overrides views_data_export_plugin_style_export::options_form

File

plugins/views_data_export_plugin_style_export_csv.inc, line 66
Plugin include file for export style plugin.

Class

views_data_export_plugin_style_export_csv
Generalized style plugin for export plugins.

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  $form['separator'] = array(
    '#type' => 'textfield',
    '#title' => t('Separator'),
    '#default_value' => !empty($this->options['separator']) ? $this->options['separator'] : ',',
    '#description' => t('This is the separator that is used to separate fields. CSV implies comma separated fields so this should not be changed unless you have specific requirements'),
  );
  $form['quote'] = array(
    '#type' => 'checkbox',
    '#default_value' => !empty($this->options['quote']),
    '#title' => t('Quote values. Useful for output that might contain your separator as part of one of the values.'),
  );
  $form['trim'] = array(
    '#type' => 'checkbox',
    '#default_value' => !empty($this->options['trim']),
    '#title' => t('Trim whitespace from rendered fields. Can be useful for some themes where output results in extra newlines.'),
  );
  $form['replace_newlines'] = array(
    '#type' => 'checkbox',
    '#default_value' => !empty($this->options['replace_newlines']),
    '#title' => t('Replace newlines in rendered fields.'),
  );
  $form['newline_replacement'] = array(
    '#prefix' => '<div><div id="edit-options-newline-replacement">',
    '#suffix' => '</div></div>',
    '#type' => 'textfield',
    '#title' => t('Replacement'),
    '#default_value' => $this->options['newline_replacement'],
    '#process' => array(
      'expand_checkboxes',
      'views_process_dependency',
    ),
    '#dependency' => array(
      'edit-style-options-replace-newlines' => array(
        TRUE,
      ),
    ),
  );
  $form['header'] = array(
    '#type' => 'checkbox',
    '#title' => t('Make first row a list of column headers.'),
    '#default_value' => !empty($this->options['header']),
  );
  $form['encoding'] = array(
    '#type' => 'select',
    '#default_value' => !empty($this->options['encoding']) ? $this->options['encoding'] : '',
    '#title' => t('Character encoding conversion'),
    '#options' => array(
      '' => t('No conversion'),
      'ASCII' => t('ASCII'),
    ),
    '#description' => t('Optionally specify a character conversion that some CSV file readers need. Note, using an external tool is always preferred and you should only use this option as a last resort. This feature requires the "iconv" PHP extension.'),
  );
}