You are here

public function TermLocalizedTranslation::prepareRow in Drupal 9

Same name in this branch
  1. 9 core/modules/taxonomy/src/Plugin/migrate/source/d6/TermLocalizedTranslation.php \Drupal\taxonomy\Plugin\migrate\source\d6\TermLocalizedTranslation::prepareRow()
  2. 9 core/modules/taxonomy/src/Plugin/migrate/source/d7/TermLocalizedTranslation.php \Drupal\taxonomy\Plugin\migrate\source\d7\TermLocalizedTranslation::prepareRow()
Same name and namespace in other branches
  1. 8 core/modules/taxonomy/src/Plugin/migrate/source/d7/TermLocalizedTranslation.php \Drupal\taxonomy\Plugin\migrate\source\d7\TermLocalizedTranslation::prepareRow()
  2. 10 core/modules/taxonomy/src/Plugin/migrate/source/d7/TermLocalizedTranslation.php \Drupal\taxonomy\Plugin\migrate\source\d7\TermLocalizedTranslation::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 Term::prepareRow

File

core/modules/taxonomy/src/Plugin/migrate/source/d7/TermLocalizedTranslation.php, line 58

Class

TermLocalizedTranslation
Drupal 7 i18n taxonomy terms from source database.

Namespace

Drupal\taxonomy\Plugin\migrate\source\d7

Code

public function prepareRow(Row $row) {
  if (!parent::prepareRow($row)) {
    return FALSE;
  }

  // Override language with ltlanguage.
  $language = $row
    ->getSourceProperty('ltlanguage');
  $row
    ->setSourceProperty('language', $language);

  // Set the i18n string table for use in I18nQueryTrait.
  $this->i18nStringTable = 'i18n_string';

  // Save the translation for the property already in the row.
  $property_in_row = $row
    ->getSourceProperty('property');

  // Get the translation for the property not already in the row and save it
  // in the row.
  $property_not_in_row = $property_in_row == 'name' ? 'description' : 'name';
  return $this
    ->getPropertyNotInRowTranslation($row, $property_not_in_row, 'tid', $this->idMap);
}