You are here

function stringoverrides_migrate_admin_export_submit in String Overrides 7

Submit-handler for stringoverrides_admin_export.

File

./stringoverrides_migrate.admin.inc, line 87
Stringoverride migration admin.

Code

function stringoverrides_migrate_admin_export_submit($form, &$form_state) {
  $lang = $form_state['values']['lang'];
  $export = stringoverrides_admin_export_text($lang);
  $filename = "my-string-overrides.{$lang}.po";
  $headers = array(
    'Content-Type' => 'text/plain; charset=UTF-8',
    'Content-Length' => strlen($export),
    'Content-Disposition' => 'attachment; filename="' . $filename . '"',
    'Cache-Control' => 'private',
  );
  foreach ($headers as $name => $value) {
    drupal_add_http_header($name, $value);
  }
  echo $export;
  drupal_exit();
}