You are here

public function Comment::prepareRow in Zircon Profile 8

Same name in this branch
  1. 8 core/modules/comment/src/Plugin/migrate/source/d6/Comment.php \Drupal\comment\Plugin\migrate\source\d6\Comment::prepareRow()
  2. 8 core/modules/comment/src/Plugin/migrate/source/d7/Comment.php \Drupal\comment\Plugin\migrate\source\d7\Comment::prepareRow()
Same name and namespace in other branches
  1. 8.0 core/modules/comment/src/Plugin/migrate/source/d6/Comment.php \Drupal\comment\Plugin\migrate\source\d6\Comment::prepareRow()

Add 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

core/modules/comment/src/Plugin/migrate/source/d6/Comment.php, line 40
Contains \Drupal\comment\Plugin\migrate\source\d6\Comment.

Class

Comment
Drupal 6 comment source from database.

Namespace

Drupal\comment\Plugin\migrate\source\d6

Code

public function prepareRow(Row $row) {
  if ($this
    ->variableGet('comment_subject_field_' . $row
    ->getSourceProperty('type'), 1)) {

    // Comment subject visible.
    $row
      ->setSourceProperty('field_name', 'comment');
    $row
      ->setSourceProperty('comment_type', 'comment');
  }
  else {
    $row
      ->setSourceProperty('field_name', 'comment_no_subject');
    $row
      ->setSourceProperty('comment_type', 'comment_no_subject');
  }

  // In D6, status=0 means published, while in D8 means the opposite.
  // See https://www.drupal.org/node/237636.
  $row
    ->setSourceProperty('status', !$row
    ->getSourceProperty('status'));
  return parent::prepareRow($row);
}