function TermLocalizedTranslation::prepareRow

Same name in this branch
  1. 10 core/modules/taxonomy/src/Plugin/migrate/source/d6/TermLocalizedTranslation.php \Drupal\taxonomy\Plugin\migrate\source\d6\TermLocalizedTranslation::prepareRow()
Same name and namespace in other branches
  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()
  3. 8.9.x core/modules/taxonomy/src/Plugin/migrate/source/d6/TermLocalizedTranslation.php \Drupal\taxonomy\Plugin\migrate\source\d6\TermLocalizedTranslation::prepareRow()
  4. 8.9.x core/modules/taxonomy/src/Plugin/migrate/source/d7/TermLocalizedTranslation.php \Drupal\taxonomy\Plugin\migrate\source\d7\TermLocalizedTranslation::prepareRow()
  5. 11.x core/modules/taxonomy/src/Plugin/migrate/source/d6/TermLocalizedTranslation.php \Drupal\taxonomy\Plugin\migrate\source\d6\TermLocalizedTranslation::prepareRow()
  6. 11.x core/modules/taxonomy/src/Plugin/migrate/source/d7/TermLocalizedTranslation.php \Drupal\taxonomy\Plugin\migrate\source\d7\TermLocalizedTranslation::prepareRow()

Overrides Term::prepareRow

File

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

Class

TermLocalizedTranslation
Drupal 7 i18n taxonomy terms source from 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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.