You are here

public function D7Webform::prepareRow in Webform: Migrate 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/migrate/source/d7/D7Webform.php \Drupal\webform_migrate\Plugin\migrate\source\d7\D7Webform::prepareRow()

Adds additional data to the row.

Parameters

\Drupal\migrate\Row $row: The row object.

Return value

bool FALSE if this row needs to be skipped.

Overrides SourcePluginBase::prepareRow

File

src/Plugin/migrate/source/d7/D7Webform.php, line 136

Class

D7Webform
Drupal 7 webform source from database.

Namespace

Drupal\webform_migrate\Plugin\migrate\source\d7

Code

public function prepareRow(Row $row) {
  $elements = '';
  $nid = $row
    ->getSourceProperty('nid');
  $webform = $this
    ->buildFormElements($nid);
  $elements .= $webform['elements'];
  $handlers = $this
    ->buildEmailHandlers($nid, $webform['xref']);
  $access = $this
    ->buildAccessTable($nid);
  $confirm = $row
    ->getSourceProperty('redirect_url');
  if ($confirm == '<confirmation>') {
    $confirm_type = 'page';
    $row
      ->setSourceProperty('redirect_url', '');
  }
  elseif ($confirm == '<none>') {
    $confirm_type = 'inline';
    $row
      ->setSourceProperty('redirect_url', '');
  }
  else {
    $confirm_type = 'url';
  }
  if ($row
    ->getSourceProperty('submit_limit') < 0) {
    $row
      ->setSourceProperty('submit_limit', '');
  }
  if ($row
    ->getSourceProperty('total_submit_limit') < 0) {
    $row
      ->setSourceProperty('total_submit_limit', '');
  }
  $row
    ->setSourceProperty('confirmation_type', $confirm_type);
  $row
    ->setSourceProperty('elements', $elements);
  $row
    ->setSourceProperty('handlers', $handlers);
  $row
    ->setSourceProperty('access', $access);
  $row
    ->setSourceProperty('webform_id', 'webform_' . $nid);
  $row
    ->setSourceProperty('status', $row
    ->getSourceProperty('status') ? 'open' : 'closed');
  return parent::prepareRow($row);
}