You are here

public function TMGMTFileTranslatorUIController::pluginSettingsForm in Translation Management Tool 7

Form callback for the plugin settings form.

Overrides TMGMTDefaultTranslatorUIController::pluginSettingsForm

File

translators/file/tmgmt_file.ui.inc, line 16
Please supply a file description.

Class

TMGMTFileTranslatorUIController
File translator plugin controller.

Code

public function pluginSettingsForm($form, &$form_state, TMGMTTranslator $translator, $busy = FALSE) {
  $form['export_format'] = array(
    '#type' => 'radios',
    '#title' => t('Export to'),
    '#options' => tmgmt_file_format_plugin_labels(),
    '#default_value' => $translator
      ->getSetting('export_format'),
    '#description' => t('Please select the format you want to export data.'),
  );
  $form['xliff_cdata'] = array(
    '#type' => 'checkbox',
    '#title' => t('XLIFF CDATA'),
    '#description' => t('Check to use CDATA for import/export.'),
    '#default_value' => $translator
      ->getSetting('xliff_cdata'),
  );
  $form['xliff_processing'] = array(
    '#type' => 'checkbox',
    '#title' => t('Extended XLIFF processing'),
    '#description' => t('Check to further process content semantics and mask HTML tags instead just escaping it.'),
    '#default_value' => $translator
      ->getSetting('xliff_processing'),
  );
  $form['xliff_message'] = array(
    '#type' => 'item',
    '#markup' => t('By selecting CDATA option, XLIFF processing will be ignored.'),
    '#prefix' => '<div class="messages warning">',
    '#suffix' => '</div>',
  );
  $form['allow_override'] = array(
    '#type' => 'checkbox',
    '#title' => t('Allow to override the format per job'),
    '#default_value' => $translator
      ->getSetting('allow_override'),
  );

  // Any visible, writeable wrapper can potentially be used for the files
  // directory, including a remote file system that integrates with a CDN.
  foreach (file_get_stream_wrappers(STREAM_WRAPPERS_WRITE_VISIBLE) as $scheme => $info) {
    $options[$scheme] = check_plain($info['description']);
  }
  if (!empty($options)) {
    $form['scheme'] = array(
      '#type' => 'radios',
      '#title' => t('Download method'),
      '#default_value' => $translator
        ->getSetting('scheme'),
      '#options' => $options,
      '#description' => t('Choose the location where exported files should be stored. The usage of a protected location (e.g. private://) is recommended to prevent unauthorized access.'),
    );
  }
  return parent::pluginSettingsForm($form, $form_state, $translator);
}