Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Comment.php

function Comment::prepareRow

Same name in this branch
  1. 11.1.x core/modules/comment/src/Plugin/migrate/source/d7/Comment.php \Drupal\comment\Plugin\migrate\source\d7\Comment::prepareRow()

Overrides SourcePluginBase::prepareRow

File

core/modules/comment/src/Plugin/migrate/source/d6/Comment.php, line 43

Class

Comment
Drupal 6 comment source from database.

Namespace

Drupal\comment\Plugin\migrate\source\d6

Code

public function prepareRow(Row $row) {
    // In D6, status=0 means published, while in D8 means the opposite.
    $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 parent::prepareRow($row);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal