public function MigrateDestinationWebformSubmission::__construct in Migrate Extras 7.2
Constructs a destination for a given webform node.
Parameters
object $node: A node object that's type has been enabled for webform use.
Overrides MigrateDestination::__construct
File
- ./
webform.inc, line 55
Class
- MigrateDestinationWebformSubmission
- Destination class for the webform_submissions table.
Code
public function __construct($node) {
parent::__construct();
if (empty($node)) {
throw new Exception(t("You must provide a webform node"));
}
// Make sure it's a webform node.
$types = webform_variable_get('webform_node_types');
if (!in_array($node->type, $types)) {
throw new Exception(t("The node must be configured to accept webform submissions but %type was not", array(
'%type' => $node->type,
)));
}
$this->node = $node;
// Webform expects the component values to be keyed by cid, so we need a
// hash to map prefixed field names to cid.
$this->component_cids = array();
foreach ($this->node->webform['components'] as $component) {
$this->component_cids['data_' . $component['form_key']] = $component['cid'];
}
// We use the functions in this file in import() but load it here so we
// only do it once.
module_load_include('inc', 'webform', 'includes/webform.submissions');
}