protected function Comment::prepareComment in Drupal 8
Same name and namespace in other branches
- 9 core/modules/comment/src/Plugin/migrate/source/d6/Comment.php \Drupal\comment\Plugin\migrate\source\d6\Comment::prepareComment()
Provides a BC layer for deprecated sources.
This is a backward compatibility layer for the deprecated migrate source plugins d6_comment_variable and d6_comment_variable_per_comment_type.
@todo Remove usages of this method and deprecate for removal in https://www.drupal.org/project/drupal/issues/3069260 when the Drupal 9 branch opens.
Parameters
\Drupal\migrate\Row $row: The row from the source to process.
Return value
\Drupal\migrate\Row The row object.
Throws
\Exception Passing a Row with a frozen source to this method will trigger an \Exception when attempting to set the source properties.
1 call to Comment::prepareComment()
- Comment::prepareRow in core/
modules/ comment/ src/ Plugin/ migrate/ source/ d6/ Comment.php - Adds additional data to the row.
File
- core/
modules/ comment/ src/ Plugin/ migrate/ source/ d6/ Comment.php, line 63
Class
- Comment
- Drupal 6 comment source from database.
Namespace
Drupal\comment\Plugin\migrate\source\d6Code
protected function prepareComment(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'));
// If node did not have a language, use site default language as a fallback.
if (!$row
->getSourceProperty('language')) {
$language_default = $this
->variableGet('language_default', NULL);
$language = $language_default ? $language_default->language : 'en';
$row
->setSourceProperty('language', $language);
}
return $row;
}