You are here

public function WebformComponents::prepareRow in Migrate Webform 7

Default implementation of prepareRow(). This method is called from the source plugin upon first pulling the raw data from the source.

Parameters

$row: Object containing raw source data.

Return value

bool TRUE to process this row, FALSE to have the source skip it.

Overrides Migration::prepareRow

File

./components.inc, line 61

Class

WebformComponents

Code

public function prepareRow($row) {

  // skip?
  if (parent::prepareRow($row) === FALSE) {
    return FALSE;
  }

  // Users may have put tokens in the default values.
  // Prompt user if mapping uknown.
  // May be possible to use _token_upgrade_token_list()
  // from token.install, returns array('old' => 'new') without % prefix.
  if (strpos($row->value, '%') === 0) {
    switch ($row->value) {
      case '%useremail':
        $row->value = '[current-user:mail]';
        break;
      default:
        drupal_set_message(t('The default value of :value in node :nid has not been remapped yet. Please submit a patch or !edit on that node!', array(
          ':value' => $row->value,
          ':nid' => $row->nid,
          '!edit' => l('edit component', 'node/' . $row->nid . '/webform/components/' . $row->cid),
        )), 'warning');
    }
  }
  if ($this->private_file == TRUE) {
    if ($row->type == 'private_file') {
      $row->type = 'file';
      $extra = unserialize($row->extra);
      $extra['scheme'] = 'private';
      $row->extra = serialize($extra);
    }
  }
}