You are here

public function MigrateDestinationWebformSubmission::fields in Migrate Extras 7.2

Returns a list of fields available to be mapped.

Return value

array Keys: machine names of the fields (to be passed to addFieldMapping) Values: Human-friendly descriptions of the fields.

Overrides MigrateDestination::fields

File

./webform.inc, line 94

Class

MigrateDestinationWebformSubmission
Destination class for the webform_submissions table.

Code

public function fields() {

  // Fields defined by the schema. nid is omitted since it should come from
  // $this->node.
  $fields = array(
    'sid' => t('The unique identifier for this submission.'),
    'uid' => t('The id of the user that completed this submission.'),
    'is_draft' => t('Is this a draft of the submission?'),
    'submitted' => t('Timestamp of when the form was submitted.'),
    'remote_addr' => t('The IP address of the user that submitted the form.'),
  );

  // Create a field for each component on the webform.
  foreach ($this->node->webform['components'] as $component) {

    // TODO: Seems like we should skip over page break components.
    $fields['data_' . $component['form_key']] = t('@type: @name', array(
      '@type' => $component['type'],
      '@name' => $component['name'],
    ));
  }

  // Then add in anything provided by handlers.
  $fields += migrate_handler_invoke_all('WebformSubmission', 'fields', $this->node);
  return $fields;
}