You are here

public function CommentType::prepareRow in Drupal 8

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

core/modules/comment/src/Plugin/migrate/source/d7/CommentType.php, line 56

Class

CommentType
Drupal 7 comment type source from database.

Namespace

Drupal\comment\Plugin\migrate\source\d7

Code

public function prepareRow(Row $row) {
  $node_type = substr($row
    ->getSourceProperty('bundle'), 13);
  $row
    ->setSourceProperty('node_type', $node_type);
  $row
    ->setSourceProperty('default_mode', $this
    ->variableGet("comment_default_mode_{$node_type}", 1));
  $row
    ->setSourceProperty('per_page', $this
    ->variableGet("comment_default_per_page_{$node_type}", 50));
  $row
    ->setSourceProperty('anonymous', $this
    ->variableGet("comment_anonymous_{$node_type}", FALSE));
  $row
    ->setSourceProperty('form_location', $this
    ->variableGet("comment_form_location_{$node_type}", CommentItemInterface::FORM_BELOW));
  $row
    ->setSourceProperty('preview', $this
    ->variableGet("comment_preview_{$node_type}", TRUE));
  $row
    ->setSourceProperty('subject', $this
    ->variableGet("comment_subject_field_{$node_type}", TRUE));
  $label = $this
    ->t('@node_type comment', [
    '@node_type' => $this->nodeTypes[$node_type],
  ]);
  $row
    ->setSourceProperty('label', $label);
  return parent::prepareRow($row);
}