You are here

function webform_export_alter in Default Content 7

Same name and namespace in other branches
  1. 7.2 plugins/webform.inc \webform_export_alter()

Handles the export of webform data to export

Also export captcha data if captcha is enabled this require a captcha patch for exporting

File

plugins/webform.inc, line 18

Code

function webform_export_alter(&$node, &$export) {
  if (isset($node->webform)) {
    unset($node->webform['nid']);
    foreach ($node->webform['components'] as $key => $component) {
      unset($node->webform['components'][$key]['nid']);
      unset($node->webform['components'][$key]['cid']);
    }
    $node->webform['components'] = array_values($node->webform['components']);
    $export->webform = $node->webform;
    if (module_exists('captcha')) {
      module_load_include('inc', 'captcha');
      $form_id = 'webform_client_form_' . $node->nid;
      if ($captcha = captcha_get_form_id_setting($form_id, TRUE)) {
        unset($node->captcha['form_id']);
        $export->captcha = $captcha;
      }
    }
  }
}