You are here

function video_preset_export_form in Video 7.2

Same name and namespace in other branches
  1. 7 modules/video_ui/video.preset.inc \video_preset_export_form()

The preset export form.

1 string reference to 'video_preset_export_form'
video_ui_menu in modules/video_ui/video_ui.module
Implements hook_menu().

File

modules/video_ui/video.preset.inc, line 802
Administrative interface for maintaining video presets.

Code

function video_preset_export_form($form, &$form_state, $preset) {

  // Unset the unnecessary elements.
  unset($preset['pid'], $preset['module'], $preset['overridden'], $preset['default']);

  // @todo: support watermarks for export
  if (!empty($preset['settings']['video_watermark_fid'])) {
    unset($preset['settings']['video_watermark_fid']);
    $preset['settings']['video_watermark_enabled'] = 0;
    drupal_set_message(t('Unfortunately, exporting the watermark is not yet possible. After importing the preset you should upload your watermark file again.'), 'warning');
  }

  // Get the code string representation.
  $code = var_export($preset, TRUE);

  // Make sure to format the arrays like drupal.
  $code = str_replace("=> \n  ", '=> ', $code);

  // Add the preset variable.
  $code = '$preset = ' . $code . ';';
  $lines = substr_count($code, "\n");
  $form['export'] = array(
    '#title' => t('Export preset'),
    '#type' => 'textarea',
    '#value' => $code,
    '#rows' => $lines,
    '#description' => t('Copy the export text and paste it into another preset using the import function.'),
    '#wysiwyg' => FALSE,
  );

  // Return the form.
  return $form;
}