You are here

function ViewsDataExportExporterXML::options_form in Views data export 7.4

Options form mini callback.

Parameters

$form: Form array to add additional fields to.

$form_state: State of the form.

Return value

None.

Overrides ViewsDataExportExporterUserConfigurationInterface::options_form

File

exporters/views_data_export_exporter_xml.inc, line 90

Class

ViewsDataExportExporterXML
Webform exporter for creating XML files.

Code

function options_form(&$form, &$form_state, $field_labels) {
  $form['transform'] = array(
    '#type' => 'checkbox',
    '#title' => t('Transform spaces'),
    '#default_value' => $this->options['transform'],
    '#description' => t('Transform spaces to valid XML in field labels (spaces create invalid XML markup). Note that invalid XML tag characters will always be converted.'),
  );
  $form['transform_type'] = array(
    '#type' => 'select',
    '#title' => t('Transform type'),
    '#default_value' => $this->options['transform_type'],
    '#options' => array(
      'dash' => t('Dash'),
      'underline' => t('Underline'),
      'camel' => t('camelCase'),
      'pascal' => t('PascalCase'),
    ),
    '#process' => array(
      'ctools_dependent_process',
    ),
    '#dependency' => array(
      'edit-style-options-transform' => array(
        TRUE,
      ),
    ),
  );
  $form['root_node'] = array(
    '#type' => 'textfield',
    '#title' => t('Root node'),
    '#default_value' => $this->options['root_node'],
    '#description' => t('The XML tag for the root node.'),
  );
  $form['item_node'] = array(
    '#type' => 'textfield',
    '#title' => t('Item node'),
    '#default_value' => $this->options['item_node'],
    '#description' => t('The XML tag for an item node.'),
  );
  if (!empty($field_labels)) {
    if (empty($options['no_entity_encode'])) {
      $options['no_entity_encode'] = array();
    }
    $form['no_entity_encode'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Disable encoding of XML entities for these fields'),
      '#options' => $field_labels,
      '#default_value' => $this->options['no_entity_encode'],
      '#description' => t('If checked field contents will be outputted ' . '<em>without encoding</em> of XML entities. This is ' . 'useful when when used in conjunction with a field ' . 'formatter that outputs properly formatted and ' . 'encoded XML data.'),
    );
    if (empty($options['cdata_wrapper'])) {
      $options['cdata_wrapper'] = array();
    }
    $form['cdata_wrapper'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Field values to wrap using CDATA'),
      '#options' => $field_labels,
      '#default_value' => $this->options['cdata_wrapper'],
      '#description' => t('If checked the fields content will be wrapped using the CDATA tag.'),
    );
  }
}