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

Breadcrumb

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

function TermLocalizedTranslation::prepareRow

Same name in this branch
  1. 11.1.x core/modules/taxonomy/src/Plugin/migrate/source/d6/TermLocalizedTranslation.php \Drupal\taxonomy\Plugin\migrate\source\d6\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);
}

API Navigation

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